Musk has a history of having his companies buy his other companies, and his most recent example of this is obviously xAI buying X and then SpaceX buying xAI. For example, the purchase of X by xAI valued X at a ridiculous ~$40 billion. And then he took SpaceX public after all of this. And SpaceX is built upon $38 billion worth of taxpayer money, grants, tax credits, etc. Must be nice to have a bunch of loser companies all buy each other and then use a government funded hype stock to make it all back.
It is absolutely impossible to know the exact details, but Musk has a history of shady deals (even having his companies bill each other for expenses), and so it's not much of a leap of faith that these moves are to absolve himself from lenders and investors by shifting debt around and moving losers into winners.
I bet that SpaceX will buy Tesla any day now.
Musk somehow weasles his way through lawsuits and gray areas and corruption and legal loop holes to just have his companies buy each other out when they start sucking, all on the teat of others and the government.