SpaceX cost about 1 billion dollars over 10 years. NASA provided ~500 million as part of launch contracts.
NASA's budget is ~18 billion a year. So out of 180 billion dollars they would have needed to devote ~500 million and then just fund it themselves.
So it's not really a money issue.