This is often (but not always!) done at events where either the organizers, or the permitting government, suspects that people may use drugs and want to "discourage" such behavior.
TBH that just makes it more of a human rights violation.
I went to a club in NYC 20-ish years ago and they were selling bottled water for $6 a bottle (in 2001!) The bathrooms only had hot water so no one could refill. It was also quite hot in the main room. Scumbags.