Back in the day (1980s), I helped run an emergency food pantry in Southern California. At the time, Sol Price (founder of Price Club, which I believe is one of the constituent chains that merged to become CostCo) donated pallets of dried milk to us to redistribute. In general, these were pallets where there had been damage, so some of the packages were not usable - the vast majority of the packages, however, were fine.
At our pantry, that donation made up a substantial part of what we gave out to people, especially those with children.
I always thought it was both generous and great business sense for them to donate that food. After all, Price Club got a tax write off, there was less waste, and the hungry people got food without it impacting Price Club's sales.