Workers are often told not to talk about pay. That's not legal
At my previous company, we didn't stop anyone from discussing pay. That's obviously illegal. What we did instead is make sure that everyone, including new college hires, understood that talking about pay almost always leads to interpersonal friction, resentment, conflict, lower work productivity, and slower progress of our company toward an IPO. In short, talking about pay would actively damage their bottom line, which is in not something in anyone's best interest. It's not a threat if you just explain how the real world works and that actions have consequences.