In 2008, Barack Obama was the toast of Wall Street. The nation's biggest banks were among the most lavish contributors to the Democratic upstart's presidential campaign.

But so far in the 2012 race, the six largest U.S. banks have switched sides in a dramatic way, and are giving far more money to GOP hopeful Mitt Romney than they are to the sitting president, according to the most recent campaign finance reports.

While the fundraising numbers are not necessarily cause for concern at the White House—Obama has raised more than two and half times as much cash as Romney overall—they offer a vivid illustration of how the president's first 30 months in office have fractured what was once a warm relationship with the largest American banks.

"You could sum it all up in a hyphenated word: Dodd-Frank," said Larry Sabato, director of the Center for Politics at the University of Virginia, referring to last year's financial reform law. "Bankers generally feel pretty put upon by the Obama administration."

Prior to the 2008 election, Goldman Sachs and its employees gave more than four times as much money to Obama as they gave to Republican John McCain. In 2011, the ratio at Goldman has sharply reversed: more than six dollars to Romney for every one dollar to Obama, according to data obtained from the Center for Responsive Politics. The Washington-based nonprofit organization's data includes contributions from the banks' political action committees and bank employees.

There is plenty of time for that trend to reverse, but so far, similar stories are playing out elsewhere on Wall Street. At Morgan Stanley, which four years ago favored Obama to McCain by nearly a two-to-one margin, Obama now trails Romney by more than five-to-one. Through June 30, Obama raised less cash from Morgan Stanley and its employees than Tim Pawlenty, who has since dropped out of the race for the Republican nomination.

At the largest commercial banks, the swing isn't quite as extreme. But Romney leads Obama in fundraising at JPMorgan Chase, Bank of America, Citigroup, and Wells Fargo, whereas in 2008 Obama raised nearly four times as much cash from those four institutions than McCain did.

Representatives of the six banks either declined to comment on the partisan shift in contributions or did not respond to interview requests. Obama's reelection campaign also did not respond to a request for comment.

Scott Talbott, senior vice president for government affairs at the Financial Services Roundtable, a lobbying organization whose members include four of the six largest banks, said that one reason for the partisan shift in contributions involves what he characterized as "pretty heated" rhetoric toward banks from members of the Obama administration.

When Obama appeared on 60 Minutes in December 2009, he said: "I did not run for office to be helping out a bunch of fat cat bankers on Wall Street." Though he struck a more conciliatory tone during a meeting with bankers the day after the interview aired, the sound bite stuck.

"That characterization captured it," Talbott said. "But it wasn't just the president. It was the administration broadly." In explaining the shift in contributions, Talbott said: "The overall regulatory environment, and not just Dodd-Frank, but the overall regulatory environment, has made it very hard for us to conduct business," Talbott said.

Many bankers are still particularly angry about Dodd-Frank, which they view as regulatory overkill. The candidates' views on the regulatory reform law may help explain banks' campaign donation patterns. While Obama has touted Dodd-Frank as a key achievement of his first term, Romney has been critical of the law. Last week, Romney upped the ante. "I'd like to repeal Dodd-Frank, recognizing that some revisions make sense," Romney said at a campaign stop in New Hampshire, according to the Boston Globe.

But Dean Baker, an economist who is co-director of the Center for Economic and Policy Research in Washington, said Obama is getting a bad rap from bankers. "I think Obama's really bent over backwards to be friendly to the business community," he said. Baker argued that the banks' 2008 spending patterns reflected the fact that Obama seemed like a more competent manager of the economy than McCain. He also said that Wall Street might have been hedging its bets by giving to a Democrat at a time of great economic uncertainty.

The shift in giving by the six largest banks is in line with a broader industry-wide trend. In the 2008 campaign, securities and investment firms, commercial banks and other miscellaneous finance firms gave about $1.50 to Obama for every dollar they gave to McCain, according to the Center for Responsive Politics. So far in the 2012 campaign, those same firms are giving about $2.50 to Romney for every dollar they give to Obama.