When I last worked in a supermarket (just over three years ago) taking home or giving away food that was destined for the bin was treated as theft. You could be fired for it if your manager felt that way inclined.
Several months before I started, several people at another store lost their jobs for just that. Instead of throwing out the bake-goods, they'd been giving them out in small amounts to people who were struggling.
Sometimes it was a handful of bread-rolls, other times it would be croissants or muffins. There was no loss to the company because the food had been written off anyway. Still -- it was treated as theft, and they were fired. The company would prefer the food was wasted than it feed people.