How does "buying out" of teaching work? Several times I have met young visiting faculty members who got "bought out" of teaching. This means that some senior professor opened their grant treasure chest and pays money so their younger co-worker needs to teach one course per semester less than usual. 

How does that actually work? On the department side, they probably need manpower to offer courses to their students. Does somebody else do the job then (for the money) or what is the background with those buy-outs? Can people buy out themselves? Who can do such things and what are the official and unofficial issues with such a procedure?
It strongly depends on the country and/or institution. To give an example: In the Netherlands, an Assistant Professor usually has a 60% teaching load and 40% research time (i.e., they are spending 3 days on teaching and 2 days on research - of course, this is somewhat blurred in daily life). If you bring in a major grant, you might use some of the money to buy off teaching time, so that you basically pay yourself 30% of your salary in order to arrive at 30% teaching, 40% 'old' research time, 30% additional reasearch time.

The department then basically has to hire someone else to take over the teaching duties you bought off.