Vending machines have very strict packaging requirements. They simply can’t handle a wide variety of products.
https://blog.bestbuy.ca/tv-audio/headphones-tv-audio/best-bu...
and
https://thepointsguy.com/news/things-sold-airport-vending-ma...
Picking an apple, banana, or bunch of grapes off a shelf is more difficult for a machine. The items are not uniform in size or shape. For a lot of produce, no mechanized handling system exists for quantities smaller than a bushel.