They spend everything they earn, plus more, on R&D. The whole goal of SpaceX is to get to Mars. No one else would take them there so they want to build spaceships and rockets that will. To fund that they build the Dragon 9 and are working on their satellite internet constellation. Everything SpaceX does is meant to fund getting to Mars. So they could potentially be cash positive, but Mars.