Never ascribe to malice what can be explained by stupidity. Obviously they shouldn't give out expired food. But I'd guess it's incompetence that led to it, not some feeling that it's ok to give expired stuff to homeless people.
Could it also potentially be negligence? But wait a minute, constantly giving out this kind of expired food? Maybe one time, or two times, but almost on a daily basis? Lol something’s gotta be up! No?
What's the benefit in keeping three year old milk? There is no way a malicious government or supermarket can keep that up, at some point they are going to run out of storage.
The other reason is that expired food is often still edible but not legal to sell and these programs are about reducing waste, not about giving free food to the homeless. If you give fresh food away what are you going to do about the waste?
If you think this is some conspiracy against the homeless you should remember that many countries have unemployment or low income benefits that also apply to homeless people which give them the ability to buy food.
Some govs like here in Toronto do give welfare but due to inflation and no meaningful increase in welfare rates for many many years, most do not have enough money for food, let alone other basic needs, which is why more and more homeless people, are spending more time looking through the garbage for their next meal. Some have told me that this is intentional so the ruling class can oppress the lower classes and eliminate them faster.