Academics are necessarily optimizing for something other than money. Nobody spends 4-7 years obtaining a PhD and then another 5-7 years pursuing tenure if their primary motivation in life is money.
The reality is: Academia can be a real shitty gig when it comes down to it. A vast majority of a professor's life is spent dealing with politics, administrative minutiae, "service", pedantic peer review, teaching, and writing grants. By the time all of that's done, you have no time left for the "fun" parts: doing the research, communicating results and having impact, and seeing its effects on the world. Not to mention the abysmal funding climate, changing role of universities, and the fact that many fields (esp. in CS) are now being pushed further, faster, and better by industry...
There's a mass exodus going on right now. At least 25% of the professors I know (I'm friends with many) have either left or are thinking about leaving academia.