His co-owner stake in id Software alone was likely worth $40 million (not after taxes of course) or more (ZeniMax raised an extra $105m for the purchase), and he had earned a fortune prior to that courtesy of 20 years of high selling games and relatively small development costs (some of which was burned on Armadillo Aerospace, perhaps up to $10 million total based on what Carmack has publicly said about the cost of operating it).
The high-priced buyout by Facebook likely increased Carmack's network significantly. $40m would be just 2% equivalent of the Facebook acquisition price. I wouldn't be surprised if Carmack owned 2% of Oculus.
With 5M I would probably play it fairly safe, keep my money in a diversified portfolio weighted towards high dividend stocks and try to live a modest upper-middle/upper class lifestyle, with the exception that I would travel quite a lot. I would probably run a small consulting firm just to stay engaged.
With 40M, I would probably have 2-4 teams of people simultaneously working on business projects. That much money lets you take risks, because even if everything goes wrong, as long as you're not retarded you can just liquidate and still have enough left to play out the 5M scenario.