A spokeswoman for the Department of State did not immediately respond to a request for comment.

Real estate groups, in their suit, argued that the ban on broker fees never came up last year as part of the sweeping rent laws adopted by the state Legislature and that the Department of State was effectively imposing a new rule without giving their industry a chance to weigh in.

The Real Estate Board and the New York State Association of Realtors, which joined in the lawsuit, praised Justice Mackey’s decision. The organizations argued that the impact of the broker fee ruling was both “immediate and devastating.”

The restraining order “means that thousands of hardworking, honest real estate agents across New York State can do business in the same way they did” before the state issued the rule, the presidents of the two groups said in a statement.

Tenant advocates cheered the broker fee ruling last week and predicted that it would be upheld despite the legal challenges.

The Department of State issued the ruling late last Tuesday and addressed a slew of outstanding questions about last year’s landmark rent laws in New York State. Buried in the memo, the department declared that broker fees, which were not specifically mentioned in the laws, must be collected from landlords unless a tenant hires a broker to find a unit.