Matt Krantz

USA TODAY

Most SolarCity (SCTY) shareholders are probably over the moon -- or maybe the sun in this case -- on news the solar company just got a buyout offer for a juicy 30% premium. But there is one high-profile person losing money on the proposed deal: Elon Musk.

Well-known entrepreneur Musk is the biggest shareholder in SolarCity, and those shares are up 8% Wednesday to $22.88 as investors digest the news. The problem is he's an even bigger investor in its Tesla Motors (TSLA), which is seeing its get shares crushed 7% on the news to $202.64.The result is that the combined reaction to the news took an instant $461.6 million out of Musk's pocked -- on paper at least.

Investors are in SolarCity are certainly happy to see a buyout offer. Shares of the company, which installs solar panels in homes and businesses, jumped 18% in afterhours trading Tuesday although the reaction has muted a bit in regular trading Wednesday. The takeover offer, which still hasn't been accepted by SolarCity, adds $176 million to the pockets of SolarCity investors. It's a welcome gain for a stock that had been down 60% this year before the offer came in.

Tesla makes offer for SolarCity

How can Musk lose money on the deal? After all, he is chairman of SolarCity and its largest shareholder with 21.8 million shares, or 22.2% of the company, says S&P Global Market Intelligence. The value of Musk's holdings in SolarCity gained $39 million.

The trouble for Musk is that 21% stake he has in Tesla. And the market value of Tesla is down $2.4 billion in the news. That translates into a $500 million hit for Musk, which completely overwhelms his gain on SolarCity.

Tesla is making the pitch hard to investors saying it will be able to turn the two combined companies into a one-stop shop for consumers looking to go electric with their cars. The combined company could not only cross-sell cars and solar panel installations, but lean on each others' expertise in batteries and design and share retail space.

Musk had better hope it works. He has millions of his own money riding on it.