That's not exactly how it works. Professors can use grant money to buy out of teaching; they are not forfeiting their base salary. That money will be (indirectly) used to fund other instructors, which may be grad students. It's not like the department head forces an unsuspecting grad student to teach; if they choose to teach, they will be paid for their teaching (tuition + stipend) so that they do not need to be funded by their advisor's grants. The money has to come from somewhere.