Things regularly get bad and then good again. The Star Trek lore is modeled on the Hoover Great Depression giving way to a New Deal and Great Society.
The fact that it was written in the 1960s, when that monumental economic transformation was just wrapping up, isn't a coincidence.
Places like Texas and Florida were being transformed from agricultural backwaters to the forefront of interplanetary travel. The distance spanned between 1929 and 1969 is borderline magical.