You literally consented to it in writing when you became a member.
If you ever take Costco to court, I'll follow along curiously.
In a lawsuit-hungry country like the US, I'm not sure how long a large company like Costco can get away with something illegal in their contract.
On the corporate side, I am required to disclose all my financial dealings including non-public equity deals(stock options in startups I work at) to my wife's work. If I don't, she can get fired.