If you look at the budget for Research in Software Engineering, which is more important to the economy and has as many scientific challenges, you'll find it's not paltry it's infinitesimal.
After WWII the country believed Gov't worked and was good for people. We believed that the space program was a response to a Russian threat. We have somewhat the same motivations now, expect that a large number of people believe any money spent by the Gov't is bad. We muster much more money now for big machines because OMG it would be terrible if the Chinese had a machine faster than ours. In science we are more motivated to use money to fight competition, not because it will help our society. We are also of course motivated by things people understand, e.g. curing cancer, though strangely not fighting diseases like Ebola which we think is restricted to Africa and which congress did not fund at the levels requested.
There's a real distortion in what we spend and what people think we spend. Polls have been conducted about whether we spend too much or too little on various items in the discretionary budget. They often think for example that many believe we spend too much on foreign aid, and those same people believe we spend more than 10x what we really do on foreign aid.