Costco, Sam’s club etc are clubs. You must verify your purchases. In Walmart you pay and get your receipt the cashier verifies your purchase and you leave. No need to have to check you again at the door unless they believe you stole something.
It is the right of the business to require it, as the ability to enter their premises is conditional on your willingness to abide by their policies. I know that.
They really should set things up in a way, where if they see you coming out of the check lanes, there should be no need to check the receipts, unless the cashier sends an alert. If they are going to use AI, that would be a good use for it.