If there is a lot of food, people will lean towards sharing their food, and helping others - even anonymously in a truly "altruistic" sense.
If everyone is starving, people will lean towards violence and stealing.
This seems like game theory, and there are historical incidents, like WWII where people were put into forced famines and didn’t act this way. People aren’t purely self interested or “logical” there is something else there besides self interest