President Obama won reelection in part by beating up on his opponent for receiving big corporate payouts in exchange for dubious work and for socking away money in tax havens such as the Cayman Islands.

So it’s a bit, well, rich that Obama chose as his new Treasury secretary a man who received a big corporate payout for dubious work and who socked away money in the Cayman Islands.

This awkward fact pattern forced a role reversal Wednesday on Capitol Hill, as Obama’s nominee, Jack Lew, came before the Senate Finance Committee for his confirmation hearing. Republicans expressed outrage about his compensation and his investment — in other words, giving him the Mitt Romney treatment. And Chairman Max Baucus (D-Mont.), an outspoken foe of offshore tax havens, helped Lew defend himself.

In Washington, where you stand on an issue depends on where you sit.

Lew, who was White House chief of staff while Obama’s campaign was pummeling Romney over his pay and taxes, received a $945,000 bonus in January 2009 after a brief tenure at Citigroup — just as the bank announced huge losses and took a taxpayer bailout. Lew also invested $56,000 in a Citigroup venture-capital fund registered in the Cayman Islands — registered in the very building, in fact, that Obama labeled “the largest tax scam in the world.”

Sen. Chuck Grassley (R-Iowa) pressed Lew to “explain why it might be morally acceptable to take close to a million dollars out of a company that was functionally insolvent and about to receive a billion dollars of taxpayers’ support.”

Grassley also asked Lew to justify investing his money in one of the 12,000 businesses based in Ugland House, a five-floor building in Grand Cayman. “There’s a certain hypocrisy in what the president says about other taxpayers and then your appointment,” the senator observed.

Lew’s explanation was Romneyesque. “I was an employee in the private sector compensated in a manner consistent with other people who did the kind of work that I did in the industry,” he said, justifying his payout. As for his offshore investment: “I reported all income that I earned. I paid all taxes due.”

In a sense, none of this matters. Lew’s confirmation isn’t in doubt, a fact supported by the way he sauntered down the hall to his hearing in the Dirksen Senate Office Building, hands in pockets. His answers were often vague but cheerful sentiments (“I would look forward to working with you and others on a bipartisan basis to think through these ideas”).

Lew’s best defense on the Caymans matter was that he lost money on the investment, so there were no taxes to be avoided. But this only proves that he wasn’t necessarily good at selecting tax havens. And his plum job at Citigroup, which Sen. Orrin Hatch (R-Utah) said has been called “a political trophy position,” is a fine example of the revolving door between government work and private-sector lucre.

Obama frequently mentioned Ugland House on the campaign trail in 2008. Baucus held a hearing on it that year, saying that the place had “a lot to do with tax evasion” and the $345 billion gap “between the taxes legally owed and the taxes timely paid.”

But on Wednesday, it was the Republicans’ turn to display a poster of Ugland House, a modern white structure with palm trees in front. “Mr. Lew,” said Sen. Pat Roberts (Kan.), savoring the irony, “welcome to what some of the press have described as the Grand Cayman Ugland House rehab and restoration hearings.”

This time, it was Baucus’s task to inoculate Lew against charges that he was associated with the very structure Baucus had identified with tax evasion. “Did you know at the time it was Cayman?” he asked. “When did you divest? . . . Did you pay taxes on that investment?”

Lew’s claims that he didn’t know where the fund was based and that he lost money on the investment didn’t quiet the Republican questioners.

“It’s no wonder that maybe you and the president haven’t proposed legislative solutions to what you consider, or what the president considers, a tax scam,” Grassley observed.

Lew argued that “the tax code should be constructed to encourage investment in the United States.”

“Ugland House ought to be shut down?” Grassley asked.

“Senator, I am actually not familiar with Ugland House,” the witness pleaded. “I understand there are a lot of things that happen there.”

Yes, and, according to the man who nominated Lew, these things are tax scams.

Read more from Dana Milbank’s archive, follow him on Twitter or subscribe to his updates on Facebook.