A staggering amount of food (and other stuff too) is thrown out because it doesn’t fit a certain narrow purpose. (Mostly, that purpose seems to be to enhance the public image of the seller.) Some of it truly is bad, but a great deal of it is good, for its broader purpose (i.e. it’s still good to eat, it’s wearable but not in style, it’s outdated but it runs, and so on).
In other words, the wrong person wants it.
Easy example: If you run an upscale grocery store, or in fact just about any grocery store, you likely can’t allow ugly food to be seen on your shelves because merely having it there would hurt your reputation. But if you’re a poor person, ugly food (just unattractive, not unsafe) is a hell of a lot better than no food.
But a business is not going to spend extra on sorting and moving their garbage - at least not without any benefit to themselves. They just want it gone, and they know that if they put it in their dumpster it will get gone. And - poor people don’t come into the store much. And if they did come into the store, they couldn’t afford much anyway, so they don’t bother.
What I’m getting at is, it would be far simpler and easier and more efficient for large stores to run full-fledged major food bank operations on their own premises. One more refrigerator and freezer, one more aisle. But the process of denying that there’s anything being wasted, and of denying that their particular store could ever house a wilted lettuce or an outdated but OK can of soup, prevents it. Or denying that “those people” exist or could show up here. I don’t know if that’s pride or greed, or some kind of corporate narcissism (or individual narcissism for that matter), or what - is it about keeping unattractive food off the shelves? is it about keeping unattractive people out of the store and out of the neighbourhood? - but there it is.
If you could do the equivalent of the current “dumpster diving” in a simple and upfront and dignified way, a lot of people would benefit and waste would be reduced.