The administration’s position would give the health and human services secretary “enormous discretion” to determine the amount paid for every item and service covered by Medicare, without reference to the detailed formulas set by Congress, Judge Kennedy said. “This flies in the face of the detailed statutory provisions,” he added.

Over the years, Medicare officials have often tried to adopt regulations that allow them to consider cost in deciding whether the program should cover various goods and services. Health care providers, manufacturers and some patients’ advocates have resisted these efforts, saying that coverage decisions should be made based on clinical effectiveness and not cost.

“We are disappointed with the ruling and continue to believe that our policy is supported by the statute,” Peter L. Ashkenaz, a spokesman for the federal Centers for Medicare and Medicaid Services, said Monday. “We are still considering our options and next steps.”

Federal health officials said the decision would make it more difficult to rein in Medicare costs.

Judge Kennedy found that Medicare and some of its contractors had unlawfully limited payments for DuoNeb, an inhalation drug taken through a nebulizer, which turns the medicine into a fine mist.

The drug, made by Dey, a unit of Mylan Inc., makes breathing easier by opening up the bronchial tubes. A single dose provides a combination of two commonly prescribed bronchodilators, albuterol and ipratropium.