Legend has it the first machine dispensed holy water in exchange for a coin in ancient Egypt.
Tobacco vending machines have been around since the 1600s.
Then came soft drinks, chocolate bars, bubble gum and condoms.
Now, vending machines can be used for anything small enough to be lifted out of a tray, it seems.
Japan has embraced the concept wholeheartedly, selling eggs, bras, live lobsters, salad, cold and hot coffee, ties and, reportedly, even used underwear from machines.
Other countries are catching on.
1. Cupcakes (New York)
In the land where "small cakes baked in cups" were first mentioned in a recipe book in the 1700s, it's not surprising the hand-held cake has gone 24/7.
Stocked with up to 750 cupcakes baked daily in the adjoining Sprinkles bakery, this sugar-pink vending machine sells cupcakes around the clock.
For $4.25 you get to choose from cinnamon chocolate, black and white and seasonal specialties such as Irish chocolate and maple bacon.
There's even a doggie cupcake for your pooch, giving you an excuse to stop by when on "walkies."
Sprinkles opened its first "cupcake ATM" in California in 2012 and has also installed the machines in Atlanta, Chicago and Dallas.
Where to find it: 780 Lexington Ave., New York
2. Gold bars (Dubai, UAE)
You might not often need to buy a gold bar in the middle of the night, but in the United Arab Emirates, the tradition of gifting gold on holidays, festivals and special occasions is still going strong.
At the Gold ATM you can purchase anything from a 2.5-gram, 24-karat gold coin to a rather more substantial 31-gram (one ounce) gold bar.
You even have a choice of designs: a locally significant Burj Khalifa design or a kangaroo or Canadian maple leaf.
The price stays up to date via the Internet, it's refreshed every 60 seconds.
Where to find it: Lower Ground Floor, next to entrance to Burj Khalifa Observation Deck At The Top, Dubai Mall, Down Town, Dubai, UAE
3. Flip-flops (Sydney)
Flip-flops, or thongs as they're locally known, are part of the uniform in this country of sunshine, surfer dudes and an all-embracing relaxed attitude.
If you've arrived unprepared, the Havaianas flip-flop vending machine in Sydney's city center could be your sole salvation.
You're at the mercy of the machine for sizes and styles, but for $20 you're good to kick off your city shoes and hop to the beach.
Where to find it: Ground level, The Galleries, 500 George St., Sydney, NSW, Australia
4. Umbrellas (Vancouver, British Columbia)
You know that you've landed somewhere with inclement weather when there's an umbrella vending machine at the airport.
One of the wettest cities in Canada with an average of 57 inches of rain per year, Vancouver prides itself in its mild climate, but gives you the option to be prepared.
For $5 you get a pocket-sized umbrella and ... well that's it.
Where to find it: Level 1, domestic arrivals just before the exit to public transportation, Vancouver Airport, Vancouver, British Columbia, Canada
5. Bicycle helmets (Melbourne, Australia)
People clad in Lycra populate Aussie roads, but they stay safe -- it's illegal in Australia to ride a bike without a helmet.
If you've just arrived and want to cycle around the sights, you can pop into one of the many 7-Elevens in town to get a brain bucket.
If you're alighting at Southern Cross Station in the heart of Melbourne, however, you can get one out of a machine.
Three sizes, one design, $5, and you have a stylish blue helmet that's safe and legal.
Where to find it: Southern Cross Station, near the rental bike stand on Spencer Street, Melbourne, Victoria, Australia
6. Caviar (Los Angeles)
Caviar and vending machines?
Beverly Hills, stronghold of the obscenely well-to-do, is home to not one but three caviar vending machines.
Called Caviar Automated Boutiques, these upscale vendors offer more than a dozen types of caviar from all over the world, packed in shiny containers offering anything from a tasty morsel at 25 grams (around $25) to party boxes of 400 grams ($999.95).
Where to find it: Westfield Topanga, Level 2, 6600 Topanga Canyon Blvd., Canoga Park, California
7. Books (Canada)
It's a universally acknowledged truth that those in possession of too many unread books continue to buy new ones.
Green Reads offers a solution: a book vending machine that allows you to get a good secondhand book for $2, as well as giving you the opportunity to donate a book for the next reader.
The machines are located in commuter-dense areas such as train stations, hospitals and airports.
A portion of proceeds earned by the machines are donated to female literacy and numeracy programs in Africa.
Where to find it: The prototype is at Barrie Transit Downtown terminal, 24 Maple Ave., Barrie, Ontario
8. Burritos (Los Angeles)
Students' diets are notoriously bad, so what better place than the University of Southern California campus for the first-ever burrito vending machine?
For $3.75 you can get a hot, steaming burrito.
So that busy students don't get too bored while
being idle for the 90 seconds it takes to dispense, they can watch a music video while the robotic machine puts their food together.
Where to find it? Parkside Apartments, 3730 McClintock Ave., USC, Los Angeles