WASHINGTON  Nearly seven years after a government auditor charged that an oil company had cheated the government out of millions of dollars in royalties, a federal judge has ordered the company to pay nearly $23 million in penalties  including $5.7 million to the auditor who uncovered the problem.

The company, Kerr-McGee Oil and Gas, was ordered to pay treble damages, or triple the $7.5 million that a jury said in 2007 the company was liable for, because of the false royalty claims it submitted to the federal government.

The judge in the case found that the auditor who first reported the royalty fraud, Bobby Maxwell, was entitled to 25 percent of the judgment, or about $5.7 million, under the federal whistle-blower program for uncovering fraud and abuse.

“I’ve been working on this case for seven years, and I’m just very happy to finally have a judgment,” Mr. Maxwell, 57, said in a telephone interview from his home in Tennessee, where he is now retired.