A big part of the problem is government regulations that cause grocery stores to dispose of any food items that reach their expiration date. I have friends who work in the meat department of a local large grocery who bring home steaks and other fine cuts of meat paying just a fraction of the sticker price simply because the meat had reached its expiration date and was unsold. There is nothing wrong with this meat and it is perfectly edible if it us cooked promptly or frozen for later consumption. Fortunately many grocery stores will donate these products to local homeless shelters.
Unfortunately some cities have outlawed donating out of date food or leftovers from resteraunts to homeless shelters or even people on the street.