I think I remember my previous employment contract here in Germany stating that talking about salary was a fireable offense. Can't remember anything similar in Sweden. Just some datapoints.
Very common in the US unfortunately. And even if it's not explicitly prohibited, it's common courtesy to never discuss your wages at work. It has just become part of the culture.