Vending machine
The first vending machine came about during 1st century AD in Roman Egypt and was invented by the Greek mathematician and engineer, Hero of Alexandria.  It dispensed a certain amount of holy water, so people would not take much of it from the temple.  People dropped tokens to release a certain amount of water.