Once a society gets too prosperous, the highest-paying jobs end up in fields like finance and law, far outpacing science and engineering. That's one reason for the decline in science -- the return on learning hard material is higher in other fields.
Also, you have a greater number of kids growing up in already-prosperous families, who don't perceive the need to become prosperous themselves, and so don't pursue higher-paying fields like finance, law, science or engineering.