Any policy of any store must be in compliance with state law.
Any policy therefore that is not is ILLEGAL.
Or at least simply unenforceable. Actually detaining you without probable cause that you specifically stole something would be illegal, because detaining anyone without authority to do so is illegal and probable cause is the only thing that gives them that authority. A policy that says they can search you apparently would not be enforceable given that they're not allowed to search even if you are suspected of shoplifting (I'm learning a lot here). The policy wouldn't be illegal, just unenforceable, but an attempt to enforce the policy can be illegal.