Be that as it may, the government is not a manufacturer, as far as I know, and has always depended on subcontractors to supply its hardware.
NASA has done and still does vehicle manufacturing itself, but typically only smaller items or prototypes. It's true that all the flight vehicles folks are familiar with were built by contractors.
I mostly commented because there are a lot of people who like to simplistically argue that "government is inept and private enterprise is always superior, so we should get government completely out of the way of private enterprise", when in reality there is often a deep interrelationship between the two. SpaceX's successes are a prime example of that.
SpaceX as we know it would simply not exist without the billions of dollars they got from government contracts, and by being able to start out with a groundwork of knowledge and expertise in a variety of spaceflight technologies generated by decades of work done by NACA and NASA.
If it were up to the free market alone, there's no way a company like SpX would be considering "lunar joyrides" today. The only reason they can consider it is because of the governmental support they've received that's gotten them to this point.
If they actually fly such a mission, I highly doubt that SpX will turn a profit on that mission alone. Much like Ford building a GT40 and winning races against the likes of Ferrari, or British Air operating the Concorde, the profit doesn't come from those events; instead, those events generate publicity, good will, desire, admiration, etc. that pay off in other ways down the line.
If you want a believable business case for why SpaceX made this announcement at this curious time (not far removed from two embarrassing launch failures, and well before either its new heavy lift vehicle or crewed capsule have even flown), consider that there is a new administration in office who has yet to exhibit any particular vision for the human spaceflight program.
NASA is working on a launch vehicle and crew capsule for operations outside of low earth orbit, with the initial missions expected to be in cislunar space in the early 2020s. SpX is essentially jumping up and down waving their arms saying, "Hey, look at me--I also have a launch vehicle and a crew capsule that can operate near the moon! Quit spending money on your (or "those other contractors' ") launch vehicle and crew capsule, and spend it on mine, instead!"
Did I mention that NASA is SpX's most important customer?