Why don't you try operating a retail store in a bad section of town. Perhaps, after a while, it might just sink in as to why they need to do this.
Like it or not, the store must operate within the LAW. If the law says you cannot FORCE someone to show a receipt for a purchase before leaving a store, you cannot do it.
You can ask, but you cannot force. I hate walmart for this very reason, and for others.
You’ve got your money, at this point I OWN everything in my bag, I have no legal obligation to PROVE to you I own it, and you have no legal right to harrass me as I leave your store.