(Reuters) - Korean carmakers Hyundai Motor Co and affiliate Kia Motors Corp will pay $350 million in penalties to the U.S. government for overstating fuel economy ratings in what officials said on Monday was the biggest settlement of its kind.

The deal comes on top of $395 million the automakers agreed to pay last December to resolve claims from the owners of the vehicles, bringing the companies' total cost for the mileage overstatements to more than $700 million.

Monday's settlement with the U.S. Environmental Protection Agency, the U.S. Department of Justice and the California Air Resources Board resolves an investigation of the South Korean carmakers' 2012 fuel economy ratings.

The penalties were the largest ever under the Clean Air Act.

"This will send an important message to automakers around the world that they must comply with the law," said Attorney General Eric Holder.

Under the accord, which involved the sale of 1.2 million cars and SUVs, the South Korean car firms will pay a $100 million penalty, spend around $50 million to prevent future violations and forfeit emissions credits estimated to be worth more than $200 million.

The greenhouse gas emissions that the forfeited credits would have allowed are equal to the emissions from powering more than 433,000 homes for a year, the EPA said.

"Businesses that play by the rules shouldn't have to compete with those breaking the law," said EPA Administrator Gina McCarthy.

McCarthy said Hyundai and Kia had committed the most egregious violation of the reporting standards. She declined to say whether other violators may also be fined.

"Every automaker will be looking carefully at its current testing procedure to avoid a similar penalty in the future," said Karl Brauer, senior analyst at Kelley Blue Book's KBB.com, who noted "frustration in the gray area between automakers' stated MPG numbers and the real-world results experienced by car owners".

In November 2012, Hyundai and Kia conceded they overstated fuel economyhttp://images.intellitxt.com/ast/adTypes/lb_icon1.png by at least a mile per gallon on vehicles after the EPA found errors for 13 Hyundai and Kia models from the 2011 to 2013 model years. Hyundai said at the time that the affected cars' reported fuel economy would be adjusted by 1 to 2 miles per gallon.

Hyundai Motor shares fell as much as 4.4 percent in Seoul tradinghttp://images.intellitxt.com/ast/adTypes/lb_icon1.png on Tuesday, extending a slide that has dragged them to their lowest in over four years.

The decline knocked Hyundai from its perch as South Korea's second-most valuable company after Samsung Electronics Co Ltd, according to exchange data on common shares, a spot it had held since March 29, 2011.

Hyundai and Kia both increased their shares of the U.S. new-vehicle market in the past decade, particularly during the economic downturn of 2008 to 2010 when consumers craved fuel-efficient and relatively low-priced vehicles.

However, Hyundai has lost U.S. market share in the past couple of years, as U.S. and Japanese rivals made a comeback.

Hyundai said on Monday that its U.S. vehicle sales fell 7 percent in October from a year earlier, lagging the market's 6 percent gain, with weaker sales of the Sonata sedan offsetting demand for its Santa Fe sport utility vehicles. Kia's U.S. shipments rose 12 percent in October. [

"We are pleased to put this behind us," said Hyundai U.S. chief David Zuchowski. The company added that it believes its process for testing vehicle fuel economy meets U.S. guidelines, and the overstatement was a result of a data processing error.

Hyundai's U.S. chief at the time, John Krafcik, stepped down after his contract expired at the end of 2013.

Kia in a statement said its priority "remains making things right for our customers through our fair and transparent reimbursement program".