A lack of morals allows thieves and their allies (you) to justify their crimes in their own minds.
Ever try asking?
And that trope you used is tired and far removed from the truth.
People aren't stealing food.
They are stealing large amounts of high value clothes, shoes, jewelry, health and beauty products, and accessories.
Stealing is wrong, even if you are poor.
What would you do if someone entered your home without permission and took whatever they wanted?
Don't lie and say, "I would let them have it and ask if they want a sandwich".
Addressing your hypothetical:
I would follow the homeless person to learn the location of his nest.
Then I would return at a later time when he is out stealing and take everything he owns, which he likely stole from others, depriving him of the enjoyment his ill gotten gains.