Japan also has very flexible zoning for residential and commercial uses, so nearly anyone can host a vending machine as a commercial enterprise, which would generally not be allowed in most other places with different laws.
Also, some of them are insanely thin, like 25cm depth for a cold drink machine, so they can fit nearly anywhere with a power outlet.