Earlier quoted context omitted.
That's how it was when I started in the U.S. But the last 25 years have seen a huge shift in workplace dress codes in the US. Organizations that resisted discovered that it had an effect on retention -- in part because there are pocketbook implications, and perhaps in part because it is just more convenient to be able to use the same wardrobe for everything.
I just wanted to underline the phrase "effect on retention". In North America, lots of talent (i.e. new grads) would straight up not pick companies with dress codes. Pay also tended to be not different, and "prestige" of working for X is not really a thing. So everything changed. Also, even in the dressed up companies, they had "dress down days". People liked them. So they had more.
I made that decision almost 15 years ago. Had offers from two companies. They were similar jobs, but with one I had to wear a button up shirt, slacks, and a tie. The other I could wear shorts and flip flops in the summer, jeans and a hoodie in the winter. I chose the latter.