Yes, it works beautifully because there are literally no bloody assholes uncivilized enough to be thieves.
Vending machines are abundant for the same reason: There simply aren't any assholes fucking uncivilized enough to loot or otherwise damage/destroy them. The supremely civilized culture of Japan manifests in superb security and all the good things that are only possible in such an environment.
You leave a vending machine outside somewhere in the United States of America? Son, that thing is going to get freedom'd faster than the US military goes bombing deserts for oil. I say that as an American and yes it is fucking shameful, but that is the state of affairs.
As an aside, Japan really likes the warm glow of a vending machine at night: Dutifully serving its customers without complaining and lighting the way; some of them come with features to remember repeat customers and their preferences, recommend products based on their expressions, and some still might even make small talk. Yes, Japan loves vending machines.
My favorite vending machine anecdote comes from HN several years ago: https://news.ycombinator.com/item?id=15412395 The pictures from the submitted post are worth revisiting too, if they were put up today people would think they were AI generated: https://web.archive.org/web/20171004222639/http://www.spoon-...
Did you know there's an anime where the main character dies and gets reincarnated into a fantasy world as a vending machine? https://myanimelist.net/anime/52619/Jidou_Hanbaiki_ni_Umarek... I got a handful of episodes in while it was airing, I'm now reminded to go back and finish the season maybe next month, but it was quite a bit more charming and interesting than I gave it credit for from the premise. Indeed, there is a lot of love for vending machines.
This despite the fact that we have numbskulls and halfwits in the area. Last year someone knocked down all the mailboxes on the nearest paved road. We also picked up an absolutely staggering number of Twisted Tea cans from the side of the road last Vermont Green Up Day.
A tent full of strawberry punnets, with a little lockbox outside to put money in.
In my experience, I’ve seen unattended farm stands, antique stores, and flea markets even in Tokyo.