Image copyright Tesla Image caption Tesla reported a record loss in its most recent quarter

Elon Musk had better have the money lined up to take Tesla private or he could be in serious trouble with regulators.

There is never a dull moment with the mercurial Mr Musk, but he excelled himself on Tuesday, stunning the markets by tweeting that he was considering taking the company private by buying publicly available shares for $420 each - a significant premium to the $340 they were trading at before he dropped his bombshell.

The shares surged 11% to $380, which will have left the people who have been betting the shares would fall nursing very heavy losses.

It will have given Mr Musk great pleasure to get one over on the naysayers. But he's playing a potentially dangerous game.

If it turns out his Twitter promise - that he has secured the tens of billions of dollars he would need to buy out public shareholders - is in any way shaky, then he could find himself accused of price manipulation. It's a very serious charge, which can land you in jail.

There is no doubt there is some sense in taking the company private. Private companies are not subject to the same scrutiny from investors, who want to see very transparent earnings on a quarter-by-quarter basis - and if you don't deliver it, your share price can be heavily punished.

Given Tesla's stratospheric ambitions, that can happen quite easily - one reason why Tesla is the most popular company to bet against (the most "shorted" stock).

Also Mr Musk did not enjoy having to answer the forensic questioning of Wall Street analysts who want minutiae on production, sales, timings, earnings et al.

In May, he told a gathering of analysts: "Boring bonehead questions are not cool. Next." Then he followed it with: "We're going to go to YouTube. Sorry, these questions are so dry. They're killing me."

If he takes the company private, he won't have to do this.

If it turns out that he doesn't have the financial firepower to deliver on his tweet, the regulators may think he's more than a bonehead.