WASHINGTON — A federal judge has struck down a new rule requiring drug companies to offer certain drugs at discounted prices, saying the Obama administration had no authority to issue the rule.

Federal officials said the decision could provide a windfall to drug makers. However, the pharmaceutical industry said that the administration was stretching the Affordable Care Act to provide discounts on more drugs for more people, and that the rule was “inconsistent with the plain language of the statute.”

The administration said it was still reviewing the decision, issued in late May by Judge Rudolph Contreras of the Federal District Court here, and had not decided whether to appeal.

In his ruling, Judge Contreras, who was appointed in 2012 by President Obama, said the administration had “acted beyond the bounds of its statutory authority.” He issued an injunction blocking the rule.