Yea, some bakeries will hand it over if you ask at the end of the day, some will put it in a bag and throw it out front instead of in a dumpster.
When I worked at the soup kitchen, the "just-expired" produce was actually just expired from the sell-by date, not the consume by date. Which means the food's still perfectly good, lots of times we'd just sit down and eat with the homeless, hell we cooked the food, at least we know it's good unlike some restaurants.