Because vending machines are now automated, they can feel like a relatively modern invention. However, the basic contraption has actually been around for more than 2,000 years. Introduced around the first century CE by Greek engineer and mathematician Heron of Alexandria, the first vending machine didn’t deliver snacks — it dispensed holy water. Similar to modern machines, Heron’s device required inserting a coin into a slot. The coin fell onto a pan that was connected to a lever, which opened a valve on the other end where the holy water flowed out. The pan continued to move under the weight of the coin until, eventually, the coin slid off. The lever would then raise back to its initial state and close the valve, stopping the flow of water.
The machine — described by Heron as a “sacrificial vessel” — was made to limit the amount of holy water people were using at ancient temples. (This was during the Hellenistic period, when Alexandria was a multicultural hub for various Roman, Greek, and Egyptian faiths.) Heron’s invention didn’t stick around with any regularity until centuries later, however. Throughout the 1600s and 1700s, coin-operated machines were used to sell tobacco in English taverns, and by the 1800s, they were selling everything from banned literary works to stamps. In 1888, a new chewing gum called Tutti-Frutti appeared in custom penny-operated vending machines on New York City subway platforms, introducing the United States to vending machines as we know them today.