There is a really important difference between companies which don't have enough margin to post a profit and companies that invest every bit of resource into capturing a new market.
They're not leaking money, that is the wrong metaphor. They're conducting an expensive land grab on 3 huge industries: Cars, Energy storage, and solar.