Consumer rights vary around the globe. In Germany the bags you bring into a shop are protected by your privacy rights. Shop clerks are allowed to ask you, but if you say no they have no right to inspect the bags against your will. Disclaimer: I am not a lawyer. The information presented in this post are legally accurate to the best of my knowledge, but I cannot give any warranties and I cannot give any advice.
This post is the short English version of a longer German post series. If you can read German texts, consider visiting my German blog with the long version where you also find several links to posts from German lawyers on this subject.
Note: It is not my intention to support shoplifters. On the contrary: as an honourable customer I want shops to take effective measures against shoplifting. Asking customers at the checkout to allow a look into bags is not effective in my humble opinion, and shops have to take other, more effective measures to reduce shoplifting.
A shop that is open to the public gives up some of its domiciliary rights. Bags that customers bring into a shop are protected by the privacy rights of the customers. A different situation arises if shops forbid customers to bring bags into the shop. If you travel a hundred miles or more to visit a model railroad shop, you are unlikely to be turned away if you are not allowed to bring your bags with you.
So far MRR shops never asked me to open my bags for them. But this happened several times at supermarkets in Germany. If you visit Germany as a tourist, you will very likely go shopping in MRR shops (if you belong to the target group of this forum) and in supermarkets.
Shop clerks have the right to ask you for an inspection of your bags, but you have the right to say no. Shop clerks have the right to call the police, but they have no right to detain you until the police arrive; you can sue them for false imprisonment if they do. I have never been threatened with the police because most shop clerks know how weak their rights are. You should know your rights, so they cannot bluff you.
They may invite you to go into the office with them. This is the standard procedure for dealing with shoplifters, but if you are an honourable customer and have nothing to hide, stay at the checkout and insist on your rights.
You can let them look into your bags. It is your decision. It is the easy way out of that situation if you let them inspect the bag – and if they ask friendly, why not? If they ask unfriendly and without any respect, why not say no? If they treat you unfriendly like a shoplifter, show them they cannot treat you that way.
The same topic in my German blog:
Taschenkontrollen im Supermarkt (Teil 1 von 4): Allgemeine Informationen