In the case of the froyo place, I don't think it was the most horrible thing in the world, but I wouldn't do it. I think 4 or 5 samples is too many to take without buying something. I probably wouldn't do 4 or 5 samples even if I was planning to buy, unless I was planning to buy some sort of massive order that might involve several of the sampled flavors if I liked them. I usually do one sample, two tops, and then buy--either a new thing I've sampled or an old stalwart. At least at a pay-by-weight place you can just get a tiny bowl of vanilla with a bit of fruit if you can't find anything else, and not spend so much ($ or calories). I think one sample, without buying, is probably fine, especially for a regular customer.
A grocery store I see as a different situation. As a PP said, the products set out for sampling are pre-chosen, not every single thing in the store, and are intended to promote those products; and most people buy something at the grocery store on that trip anyway. It would be dodgier to me if someone walked into the grocery store with the intent to only eat the samples, ate every sample they could find, and didn't buy anything at all.