SpaceX, a leader in rocket launches, lost billions of dollars in recent years after a merger with Musk's artificial intelligence venture, xAI.