The machines also displayed delay times for the unhealthy snack items on a bright LED screen.
If an unhealthy snack was chosen, the machine began a 25-second time delay before it released the snack whereas healthy snacks were dispensed instantly.
The 25 second time delay was determined from previous experiments which found that it was long enough to change some people's minds, but not so long that it annoyed people to the point that they didn't use the vending machine.
What classifies as healthy is still up for debate within the scientific community, and the high fat-low carb vs low fat-high carb researchers are still battling it out.
This study chose to define a healthy snack as one that had to meet 5 out of 7 criteria, including having fewer than 250 calories, 350mg of sodium or 10mg of added sugars per serving, containing no trans-fats, getting less than 35 per cent of their calories from fat and having more than 1g of dietary fibre.
In addition to the delay bar, the researchers also monitored other variables including a snack tax which added 36 cents on to unhealthy snacks and a different experiment where a 36 cent discount was applied to healthy snacks.
Over 14 months the researchers analysed over 32,000 snack sales.
The results showed that both the time delay and the food tax helped to encourage people to choose healthier options from the vending machines.
However, the snack tax system also resulted in an effect on the total revenue of the vending machines which was not popular with machine owners.
This is not the first time vending machines have been targeted.
A previous unpopular intervention removed all junk food from the machines which ended up restricting consumer choice and negatively affecting vendor profits.
The time delay tactic however did not harm the revenue of the vending machine and was successful in persuading some people to make healthier choices.
Time delays could work because people don't like waiting so pick a quicker choice, or because giving people time to think empowers them to make less guilty choices.
These results open up ideas around how we as individuals could use this science to help create life hacks for healthier life choices, such as by placing unhealthy snacks in the freezer requiring us to wait for them to defrost before they can be eaten.
Supermarkets could also position their unhealthy products in difficult to access areas or have express checkout lanes which only allow customers with healthy foods to use them.
Whatever the hacks are that might come from this study, a lot of behaviours will need to change if we want to tackle our growing challenges around obesity and chronic diseases.
Perhaps removing instant gratification by adding time delays could be one new strategy to help in that battle.