I am actually willing to believe that I could 'survive' on food samples for at least a few days. Just me though not a whole family and I have several distinct advantages.
1. I am young and in shape
2. I have no dependents
3. I have access to shelter
4. Access to clean water
5. Access to clean clothes
6. I have a costco membership
Without these, especially #6, the idea isn't even possible. Costco would not allow one homeless person to scavenge in their store yet alone hundreds of homeless people several times everyday.
Given that mental disease is one of the leading causes of homelessness you can't even trust that a homeless person could make it to costco on a regular basis to eat enough to stay alive. That is why shelters and churches send people out into the streets with food and clothing because some of the homeless aren't able to fend for themselves.
Another issue would be crime. Crime is prevalent in homeless communities due to necessity, drug use, or whatever it is there. If costco where to allow the entire homeless population in to the store several times a day to forage amongst the free samples you can bet your life stuff would get stolen. If costco didn't reverse their foraging policy they would have to raise prices to compensate for the theft. So in effect society would be paying to feed the homeless through higher retail prices. That plan is just brilliant.