Heron of Alexandria was an inventor who died around 70 AD. He actually conceived the first vending machine to dispense holy water in temples.
That machine came about thanks to the handiwork of Heron of Alexandria. Now, Heron invented plenty of things that helped set the stage for our modern society. Steam engine? He was all over it. A wind-powered machine? That was him. The syringe? He got there first.
But many of these things pale in comparison to the machine he created that efficiently ensured that people weren't taking too much holy water at the temples where they went to worship. It was an annoying, frustrating problem, but Heron came up with a solution that was immensely clever.
It was a simple but ingenious mechanical device that used the weight of a coin to temporarily open the floodgates. It wasn’t a big hit, though, and the idea was shelved for 1800 years. But then the history of vending machines really takes off. Ernie Smith runs down the highlights of vending machine history for us in an article at Atlas Obscura.