Steven Mnuchin has made a career out of being lucky.

The former Goldman Sachs banker nominated to become Donald Trump’s treasury secretary had the perspicacity to purchase a collapsed subprime mortgage lender soon after the financial crisis, getting a sweet deal from the Federal Deposit Insurance Corporation. Now, if he’s confirmed, he will likely be able to take advantage of a tax perk given to government officials.

Mnuchin was born into a family of Wall Street royalty. His father was an investment banker at Goldman Sachs for 30 years, serving in top management. He and his brother landed at the powerful firm, too. After making millions in mortgage trading, Mnuchin struck out on his own, creating a hedge fund and building a record of smart and well-timed investment moves.

He dodged disaster when he inherited his mother’s portfolio. She was a longtime investor with Bernie Madoff, the largest Ponzi schemer in American history. After she died in early 2005, Mnuchin and his brother quickly liquidated her investments, making $3.2 million. The Madoff trustee, Irving Picard, sued to retrieve the money from the Mnuchins, as he did from other Ponzi scheme winners, contending that they were fake gains. A court ruled that Picard could only claw back money from those who had cashed out within two years before the collapse. The Mnuchins, having pulled out roughly three years before, got to keep their Madoff money. That something was dodgy about Madoff was an open secret on Wall Street.

After the financial crisis, the FDIC seized IndyMac, whose irresponsible mortgage loans failed as the housing bubble burst. Desperate to offload the bank, the FDIC subsidized the takeover by sheltering Mnuchin and his team of investors, including hedge fund managers John Paulson and George Soros, from losses. The investors injected $1.55 billion into the bank in 2009. They changed the name to OneWest and five years later, sold it to lender CIT for more than $3 billion, doubling their investment.

Mnuchin also benefited from what may have been a nice fluke a little later. He served as the co-chair of Relativity Media, a film and entertainment company, for about eight months until May 2015. Relativity filed for Chapter 11 bankruptcy in July 2015. Just before it collapsed, Relativity paid off a $50 million loan to Mnuchin’s bank, OneWest, in full.

Paying off one creditor in full just before filing for bankruptcy looks questionable, especially when there is the appearance that such a deal isn’t at arm’s length. One Relativity investor cried fraud and sued in 2015, contending that Relativity used its loans for improper purposes, including to make payments to OneWest. Mnuchin’s lawyer called the claims preposterous and the suit was initially thrown out. A lawyer for the investor, a film financing company, told the Los Angeles Times that it planned to refile.

Surprise: Trump’s Adviser on Wall Street Regulations is a Longtime Swamp-Dweller Trump’s transition adviser for financial regulations works for a firm that is emblematic of the Washington revolving door. Read the story.

Mnuchin was blessed again when the Obama administration did not crack down harder on foreclosure abuses. OneWest got a reputation among activists and borrowers as one of the more feckless banks, accused of throwing borrowers out of their homes, denying mortgage modifications, and targeting the elderly with reverse mortgages. The Office of the Comptroller of the Currency settled with OneWest, and over a dozen other banks and mortgage servicers, over its robosigning practices in 2011. That regulatory settlement, called the Independent Foreclosure Review, was an utter debacle, as ProPublica has detailed. Regulators set up a process for consultants to review how the servicers had handled modification reviews, which meant in effect that the banks were monitoring themselves. The regulators did not punish any top financial executives over foreclosure mistreatment. In a happy circumstance for Mnuchin, the Department of Justice and state attorneys general did not include OneWest in their subsequent and more punitive settlement over foreclosure bad behavior.

Mnuchin was fortunate once more to pick the right candidate, Trump, early; most of Wall Street assumed that Hillary Clinton would win and bet accordingly with its political donations.

What good happenstance, then, that Trump didn’t mean what he said about Wall Street on the campaign trail.

On the stump, Trump said, “We will never be able to fix a rigged system by counting on the people who rigged it in the first place.” He attacked Goldman Sachs by name, saying that the bank “owns” Ted Cruz, whose wife worked at the firm. “I know the guys at Goldman Sachs,” he said, “They have total, total control over [Cruz]. Just like they have total control over Hillary Clinton.” Trump put an image of Goldman CEO and chairman Lloyd Blankfein, along with other Jewish figures in finance like George Soros and Janet Yellen, in a commercial late in the campaign that was widely decried as anti-Semitic.

Trump did not feel such a strong antipathy for Goldman that he passed over a firm veteran to be his treasury secretary.

Mnuchin still owned $97 million of CIT stock as of last February. The Treasury Department will likely require him to sell those shares, since it poses a conflict of interest for the treasury secretary to own a stake in a financial institution. But therein lies a final good break for Mnuchin: According to a provision of the tax code, he can defer taxes, as long as he complies with certain conditions. That benefit, available to all officials who are required to sell investments upon taking a government job, could be worth millions to Mnuchin.