I use to work at a grocery store and for every food item that was stolen, dozens more of the same product was thrown out for being past expiration. Like many companies they want the shelves to be full at all times, which means they over produce and order product. Nothing was recycled or donated, just straight into the trash. If I ever saw anyone stealing while I was working, I just saw it as less work I has to do with taking count and throwing out food later. Plus someone actually got to eat it!
Similarly- my daughter's last science unit (for some reason) had a big thing about how you shouldn't waste food to help the environment. And I'm fine with telling kids not to waste food to help the environment. But maybe it should also mention that McDonald's throws out every perfectly edible burger that's sat under a heat lamp too long and maybe that should be a bigger concern if we're talking about food waste and the environment.
Even at the middle school level, they're blaming the individual when the corporation is so much worse.
My guess is they don't want to be responsible for lawsuits if someone eats food they had to throw out and it causes a problem. (past expiration date, damage, ect.) Then again I am not a multi-billion dollar business executive so the reason could very well be "fuck the poors" for all I know.
There are literally laws that say you can donate with no liability. It's a common misconception that is too pervasive even in those who are in charge.
In fact, the ones who do realize they can do it with no liability have calculated the costs of throwing away(trash removal is subsidized) vs creating an entirely new process for donating food and worry about its handling(vs. The very lax and rough handling trash gets). Not to mention that they will have to move it to a separate location as it can bring unwanted traffic that is not profitable.
Donating is not an easy task. It's a burden, and there isn't a public service to make it easier and similar in cost to trash removal services. It's not the company's fault. It's the government and charities that are not getting involved.
I believe some store locations did, or at least said they did. I'm not sure why the ones I worked at didn't. Even if the food didn't go to people, I've heard they can go into making feed for animals and fats from unused foods can go into make up. Probably what other people have said, if they start donating, then less product would be purchased. I don't have a better answer unfortunately, I wasn't given one when I asked.
Supermarkets in my country do. They also have bins for items that are getting really close to expiration, where you can buy them with a hefty discount. Another supermarket puts orange stickers giving a discount on close-to-expired products.