The academics in question might have little choice but to give away some/most of the content for free, as it is often mandated by university- or department-level policy. At least as far as internal use of the courses is concerned, the incentive here is clear for the university: reduce your dependency on a given superstar prof leaving (very slightly, admittedly).
As for the ego trip, I doubt it (in most cases): research gives you the recognition of your peers. There is a clear trade-off in allocating your time towards stellar teaching or stellar research. Few professors manage both. And stellar teaching tends to get much lower recognition from the peers.
governments should be funding universities because R&D has social and economic benefits. However, the paying customers of universities (students) are primarily interested in the job market, so universities will have a role as long as companies continue to use them as hiring filters. since direct aptitude testing by corporations is a legally tricky area, i predict the current credentialing system is unlikely to change for a while.