People seem to think that if monies were diverted it would cure poverty or something like that. Of course, it wouldn’t. Instead, we would either get one more fighter airplane or make the superrich a tiny bit richer, or we would subsidize that which kills us all even more than we already do. If one worries about poverty, one should stop the subsidies, make the super rich poor (which would have all kinds of further advantages), and reduce the military to 10-20% of what it currently is.
I don't think that is the way it works at all.
Even in a country as rich as America money is scarce resource so there is considerable competition for it. Scientists will always argue for more money for their own fields. They cannot be counted to agree among themselves about how that money should best be allocates. The politics of the budgetary process will always exist.
At the same time social class has a strong influence on salaries in the US. Is a public school teacher more productive than a nursery school teacher? There is plenty of evidence that shows a child's earliest years are the most important for determining that child's life. Is a post-secondary school teacher more productive than a public school teacher? I know of no data to support that. Is a scientist more productive than a construction worker? Again, I know of no data. But these people all get different salaries.
If Congress cuts back on salaries for scientists no scientist's income is diminished; we simply employ fewer scientists. If a state legislature cuts back on funds for state universities no professor's salary is diminished; tuitions are simply increased. Social class remains in place.