Reading and West Berkshire councils have joined forces to block government proposals on affordable housing, the BBC has reported.
The government wanted new developments of under 10 homes to be exempt from affordable housing quotas imposed by local authorities.
A High Court judge found in favour of the councils and ordered the government to pay costs.
The Department for Communities and Local Government (DCLG) said it would try to overturn the decision.
In a statement, it said it was “disappointed” by the judgement, as the new legislation had aimed to “reduce red tape and extra costs that prevent smaller developments getting built”.
The ruling means councils can continue to seek affordable housing contributions and “section 106” payments arising from developments of fewer than 10 homes in urban areas and five homes in rural areas.
Section 106 payments are used by local authorities to fund improvements to infrastructure such as roads and schools.
According to the Federation of Master Builders (FMB), the decision will heighten the housing crisis.
FMB chief executive Brian Berry said: “This decision comes just at the point at which more and more sites are being subject to Community Infrastructure Levy charges. Taken together, this will push up demands on small house builders to unprecedented levels. Up until only a few years ago, planning guidance contained a national indicative minimum site size threshold of 15 dwellings for affordable contributions.
“As such, the government’s decision to move back to a 10-unit threshold is hardly an unreasonable step. Rather it recognised that the small firms that invariably build out small developments have proportionately higher costs and do not necessarily have the muscle or inclination to challenge local authority demands for affordable housing.”