I acknowledge that there are no actual rules on pax dress for US-flag carriers, except for very basic ones (e.g., can't be naked). Now if you're in the last row of economy, then I feel for you -- be as comfy as possible!
However, if you are in business or first class, then a part of the service is the ambience, as it is in a nicer restaurant vs. McDonald's. On United, you're served a meal on china on a white tablecloth, with cloth napkins, wine glasses (not plastic), etc. It is not 5-star service, but it is markedly better than the experience in the economy cabin. The passengers are part of the ambience. While nobody is forced to dress a certain way, how people dress (and behave) does affect the overall environment of the cabin, just as is true in a higher-end restaurant.
I live and work in D.C., which is somewhat more formal than many cities in the U.S. I wear a suit 2-3 times a week and a sports jacket (with shirt and tie) 1-2 times/week. Most of the meetings that I attend are filled with males in suits, in generally boring colors (blue suit, white shirt, red tie), or females in analogous clothing. Just look on C-Span and see your senators and their staffs.