NEW YORK ( TheStreet) -- Tesla Motors ( TSLA) cofounder Elon Musk is investing $100 million in the company's stock as the electric car maker uses a sharp rise in its shares to issue stock and repay government loans. After the market close on Wednesday, Tesla said it will issue up to 3.1 million new shares and $450 million in convertible notes, in a capital raise that's been speculated amid a sharp run up in the automaker's stock. Elon Musk, Tesla's chief executive and cofounder, is committing to buy $100 million in Tesla stock. Musk will purchase $45 million of Tesla's stock in the share offering and an additional $55 million in shares directly from the company in a private placement, according to a press release. In total, Tesla expects to raise about $830 million through the capital raise, in a move to repay the company's outstanding loans with the Department of Energy. Proceeds will also be used for general corporate purposes, Tesla said in a statement. The interest rate, conversion price and other terms of the notes on Tesla's convertible note offering were not announced. Tesla also didn't indicate a price for its secondary stock offering. Tesla shares closed Wednesday trading up nearly 2% to $84.84. In after-hours trading, shares gained over 5% to $89.39, on news of the capital raise. Goldman Sachs ( GS) will lead Tesla's secondary stock offering, while it, Morgan Stanley ( MS) and JPMorgan ( JPM) will act as joint book runners in the convertible note offering. Tesla recently announced it will repay $465 million in loans received under the Department of Energy's Advanced Technology Vehicle Manufacturing Program (ATVM) by late 2017, five years ahead of schedule. Were Tesla to repay its ATVM loans in full ahead of a 2022 maturity, deeply discounted warrants held by the Department of Energy (DoE) for over 3 million Tesla shares will be cancelled, according to an April statement from company spokesperson Shanna Hendriks. The government holds 3,090,111 Tesla warrants, some of which Tesla says have an exercise price of $7.54 and some carry an exercise of price of $8.94 a share, according to the company's most recent annual report. The warrants currently are worth over $200 million at Tesla's current price.