New Hampshire’s Supreme Court has ruled against a group of nursing homes that claimed the state owes it $9 million in Medicaid surplus funds.

The New Hampshire Health Care Association, a trade group that represents the homes, disputed the Department of Health and Human Services’ accounting methods and how the surplus funds were allocated. It charged that the state was withholding the funds from the nursing homes to generate revenue for itself.

In 2008, Gov. John Lynch (D) signed an executive order requiring that any money saved by requiring state agencies to make cuts must go back to the state’s general fund. After the executive order was filed, the NHHCA group challenged the governor’s actions in Merrimack County Superior Court. The state Supreme Court upheld that court’s ruling in a decision announced Friday, deciding that the governor’s actions were legal.