Why do professors use course-buyouts?
Actually, it is both better and worse than you describe. The substitute faculty member is unlikely to get $10K to teach the course. Probably closer to $2k. 

Even if the professor doesn't teach as much and spends more time on research, he/she is also expected to advise and guide graduate students in their own research. This also benefits the university, of course. 

But the overhead reimbursement is to reimburse real costs. When the professor/university get the grant it is up to the university to verify that the funds are properly used. This means that people are paid a salary to manage the grant and report to the funding agency periodically. It isn't just a "gift" as it entails real responsibilities (and potential liability). 

But if you are thinking of the university as a profit center you are mistaken. The university benefits both from good teaching and from good research (and advising). But most universities are not-for-profit and whatever revenue comes in from whatever source goes back into the system, not to owners/shareholders. Some money is put aside for future needs and uncertainties. 

If there is abuse in the system it is that there are probably too many administrators, but that is a different issue.