Tesla was very profitable. Gross Margin is 14% now of revenue now. 1/4 of their their $8B profit is emissions credits. That's not shabby and they have lowish debt ($20B).
But it isn't what I'd call insane. Google's gross margin is 58%, profit is $349B.
I'm not sure why you're comparing the gross margin of a car company to an internet company. General Motors has a gross margin of 10%. Ford's is 7%. Historically Tesla's was ~25%, but yeah it's fallen a bit since I last looked.
Only because they're funneling every dollar they earn into Starship. But as Starship contributes absolutely nothing to current revenue, excluding those costs is the only fair apples-to-apples comparison. We don't know their exact costs because SpaceX is still a private company, but estimates are on the order of 60% profit margin across their business lines.