The US in the 1960s was more capitalist than it is now (by governement size, spending, taxation, regulation and economic freeodm, too-big-to-fail, etc.).
There has to be profit first to be able to fund big things like Apollo. Profit is good.