At costco, they don't put your stuff in a bag, implying privacy. Your purchases are lined up in a cart so the person can do a count.
Maybe the insult is the implying of items in a bag being now mine, and they want to look at them...
At costco, the shoppers just take like the new shoes out of the boxes, put their old ones in the box, and walk right out of the store.
I know this because I have gone to purchase a box of shoes and found someones old ones inside.
My bet is that at a membership club (ie. Costco, Sams, etc.) it could be part of the membership terms so failure to allow the check could violate the terms of membership or conduct, however at a publicly available retail store you could walk out without any recourse. They could not detain you without showing some cause to believe that you had taken something without paying.