The candy is loaded onto a shelf that fits into grooves inside the container and sits on a spring. The container holds the candy in place. ... Many vending machines dispense packages of candy, but they can be used to dispense anything: soda, hand soap, gasoline, coffee, ice cream, or accessories for electronic devices.