So far it looks like shareholders, employees and, of course, taxpayers are the big losers in the unprecedented Fannie Mae and Freddie Mac government bailout just announced over the weekend.

But some people are going to come out of this mess just fine, The New York Times says. And guess who that might be?

Departing chief executives Daniel Mudd at Fannie Mae and Freddie Mac’s Richard Syron could leave with lucrative pay packages totaling milions of dollars. All this despite the fact that the companies they headed failed so spectacularly the government had to step in.

From The Times:

Under the terms of his employment contract, Daniel H. Mudd, the departing head of Fannie Mae, stands to collect $9.3 million in severance pay, retirement benefits and deferred compensation, provided his dismissal is deemed to be “without cause,” according to an analysis by the consulting firm James F. Reda & Associates. Mr. Mudd has already taken home $12.4 million in cash compensation and stock option gains since becoming chief executive in 2004, according to an analysis by Equilar, an executive pay research firm.

Richard F. Syron, the departing chief executive of Freddie Mac, could receive an exit package of at least $14.1 million, largely because of a clause added to his employment contract in mid-July as his company’s troubles deepened. He has taken home $17.1 million in pay and stock option gains since becoming chief executive in 2003.

It’s nice to know that Syron, in the midst of a meltdown of his company that threatened the stability of the housing market and of the U.S. economy itself, took the time to redo his contract to ensure he would be enriched should Freddie Mac fail. It’s so inspring to have someone at the top looking out solely for himself while mortgage rates were going up and millions of Americans faced losing their homes.

That little tactic, in and of itself, should give the government more cause to step in and say: No way. We own the place now – and we no longer have to put up big salaries for no-talent executives to enjoy cushy retirements while everyone else pays for their mistakes.

Here’s hoping the government makes an example of these two — and quickly — before top executives at all those failing banks get the same idea and start rewriting their own employment contracts.