Maryland Gov. Robert Ehrlich has returned more than $540,000 in political contributions to the Republican Party that were funneled through a federal account to his re-election effort, according to campaign officials and documents obtained by The (Baltimore) Sun.

The money was returned after the state board of elections said the money shifting violated state law.

• Click here to check the latest Maryland governor race polls @ BALANCE OF POWER.

By using the federal account to pay for the governor's re-election effort, Ehrlich was able to receive large sums of in-kind contributions from the Maryland Republican Party by bypassing a $4,000 donation cap set by state law.

Ehrlich and his Democratic opponent, Baltimore Mayor Martin O'Malley, both filed the final campaign finance statement they will submit before Tuesday's election. The reports show that Ehrlich has a significant financial advantage.

After the half-million dollars is returned, Ehrlich's campaign will have more than $2 million in the bank as of Oct. 22. That's compared to nearly $600,000 for the O'Malley campaign.

The Ehrlich campaign tapped into the federal account, which can accept $10,000 contributions compared to the $4,000 limit that applies to state accounts.

The federal account is controlled by the state Republican Party. It received hundreds of thousands of dollars in contributions in the days leading up to a $1 million fundraising event in May featuring President Bush.

The state party spent money from the account on behalf of its candidates, Ehrlich and U.S. Senate candidate Lt. Gov. Michael Steele, for salaries, cell phones, mailings, postage and other services, state election records show. The in-kind contributions allowed the Ehrlich campaign to direct its own vast resources elsewhere, such as toward television advertising.

But in a State Board of Elections letter obtained by The Sun that was sent to the Republican Party, election officials said that using the federal account violates state law because it allows an entity to contribute in excess of state contribution caps. The letter is dated Sept. 1 and was obtained by The Sun on Thursday through a Public Information Act request.

"The state Board of Elections believes that these in-kind contributions are not permissible under the Maryland Election Law Article," the letter reads. "Accordingly, the Republican State Central Committee must be reimbursed the full amount of the in-kind contributions made on the behalf of Bob Ehrlich for Maryland."

Ehrlich spokeswoman Shareese DeLeaver said the campaign returned the money after receiving the letter. State campaign finance records released Monday indicate the campaign transferred more than $540,000 to the party over several weeks from the end of September through mid-October.

"Upon receipt of the letter, we immediately began to address the concerns of the state Board of Elections as reflected in our most recent campaign finance report to the satisfaction of the state board," DeLeaver said.

• Click here to visit YOU DECIDE 2006, FOXNews.com's complete election center.