Also, judges are not perfect and are known to make mistakes.
So now a homeless guy reads "Food is free if you're hungry!". He goes... really?? Walks into store. Right away, the store security is eyeballing him, because he's homeless, and the store owner reads the news, too. So now the homeless guy has a decision: since he's being watched even closer now, does he give up early, or make a brazen attempt? He makes the attempt... now the security catches him. "I'm hungry!" he says. "Too bad", security says. They take the food back and call the cops. One court case later, the guy is released. The store still has their goods.
There is plenty of recourse to cover theft (that which already exists and resulted in the guy getting caught the first time), food is not free, insurance doesn't go up. And pricing is already adjusted to offset theft, like I mentioned in another thread. The effect on the bottom-line for markets is nearly zero. Everything is the same as before this judgement, except the prison isn't full of homeless people who can't pay their fines.
Like someone else mentioned, either homeless people will be banned from stores, or they will be scrutinized more, and outdoor markets may retain some new form of controls or increased security. Or their culture will simply adapt to this new way of life, since not every person who can steal will steal (a weird idea for the US, but many foreign cultures work this way).
But there will not be roving gangs of hungry homeless trampling children and busting down stores. Business will not decline from the ravages of the hungry. And in a weird twist of the judgment, if they stole to have food, they'd no longer be hungry, and therefore would be committing crimes again. The judgement's language is very specific about the nature in which this took place and what it means.
Some people thought a similar thing a few years back in the US. The thought was that since sometimes innocent people are injured due to police chases that there should be restrictions on such chases, most of them involved giving up. The leading argument against was that you are essentially telling criminals to always run because the police will break off. I believe cooler heads prevailed that instituted new policies that did not allow such nonsense.
As for your example; do you think the store just returns the attempted stolen item to be placed back on the shelf to sell to another customer? Even if the thief is caught, there is a form of loss due to the product likely being useless to them.
Finally, yes the guy was caught but not punished. That is not necessarily a recourse for the owner of the stolen property, they are still out the stolen property. It's not like the neighbor's kid stealing your bike that can be returned, they can't sell food handled by a thief, security, and or police. If the effect on the bottom-line is nearly zero then why bother trying to prevent theft at all?