When I worked at a grocery store we were supposed to make absolute sure that nobody got their hands on the (perfectly good) produce and bakery items we threw away every night. I don’t know if it was true, but the manager told us that our grocery chain used to donate it all to a homeless shelter and then they got sued by someone who claimed they got sick from expired produce.
I believe it. Our local Smith's grocery used to donate their day-old bakery goods to the Senior Center. One old biddy found a spot of mold on a pie, went to the store, and complained.
End of donations.