In October, the same month Elon Musk was acquiring Twitter, he took out what the Wall Street Journal describes as an "unusual" $1 billion loan from SpaceX. The following month, he paid it back in full, plus interest. It's not clear what the loan was for, and Musk has not commented on the article. He put up about $25 billion in cash in late October as part of his $44 billion Twitter takeover. In November and December he also sold billions of dollars worth of his Tesla stock—over a time period of more than a year, the amount of Tesla stock he sold ended up totaling $39 billion.
As the Journal puts it, Musk is a "cash-poor billionaire," with much of his money tied up in shares of his own companies, and he's often borrowed money from those companies (SpaceX in particular) in moves that allow him to raise funds without giving up his shares. He's also borrowed from banks against his shares in various companies. As for the $1 billion SpaceX loan, it came during a year when the company reported $4.7 billion in cash and securities on hand by the end of the year. See the Journal's full exclusive, which goes over Musk's history of borrowing, here. (More Elon Musk stories.)