There are laws in MA against distributing food that is unfit for consumption (ie-past its due date). I remember one specific incident where a small town was giving their old donuts (those that had been on the shelf since the last delivery) to local food pantries-until the govt put a stop to that. They were told they HAVE to throw it out. Their solution? They put them in bags, then in boxes, call the local food pantry, and then place them on top of the dumpster. The donuts & bagels would then go to the local Veterans Outreach programs-they were fine, just a few hours old. I myself benefitted from their generosity more than a few times.
I would hope that I would never become that desperate-I would be wary of picking out of garbage cans-but, one can never tell these days.