No, they are not. The merchant has the right to set terms and conditions of the sale. You are free to accept or reject them or negotiate different terms. A bag search may well be within the four corners of the contract. Payment is only one element of the contract, you must meet all. Failure to do so means the contract is voidable.
No where I have I seen any attempt to justify loss prevention searches as being part of the purchase contract. I do give you credit for a new and novel approach. However under it, if I do not purchase anything, the merchant could not ask someone to open their purse or other containers they have with them.
Common law instead has provided “shopkeepers privilege” which is quite narrow in scope, though some would have us believe otherwise.