Some of the older models were plug-in rather than battery. You can still find those on Amazon, but maybe from third-party sellers.
https://www.amazon.com/Activated-Dispenser-Gumballs-Touchless-Hands-Free/dp/B07KGLJZD1/
Note, however, that all of these work like touchfree soap dispensers: it’s only detecting motion right underneath the spout. These were originally designed for offices where they didn’t want everyone putting their hands in the candy bowl.
If you find a device with a remote, like the dog training device I put in my first post, then it’s easier because the visitor doesn’t have to figure out how to activate it, you can use the remote to dispense even if the visitor is several feet away from the device.