The first vending machine was invented in Ancient Egypt in 215 BCE and sold holy water. It worked by the use of levers meaning a coin would open a tap, letting water out.