Sounds like he took advantage of an ignorant government. I'd do the same. So did Wall Street, but we got less back from that one.
They had a loan program to kick-start electric vehicles. One of their loans was largely responsible for the existence of Tesla and its ensuing success. The loan was paid back.
Should the government have been more profit-maximizing? Do we want civil servants taking large equity stakes in private companies? We fund research (both directly and through the university system) all the time with the understanding that the net benefits to society outweigh the direct costs of the programs.
AFAIC Tesla upheld their end of the bargain and society is up by quite a bit. This is in stark contrast to other bullshit that the US government has funded which is wasteful at best. War, war on drugs, war on privacy, bankers, ...