Greggs could be forced to provide toilets in all its stores that have customer seating following a High Court ruling.
Hull City Council, which brought the action, said the chain should provide sanitary facilities if food and drink are consumed on the premises.
Newcastle City Council, Greggs' home town authority, opposed the move.
An earlier ruling in Greggs favour said outlets serving simple takeaway food did not need toilet facilities.
Hull City Council took legal action after Newcastle City Council issued guidance relating to toilet provision in food outlets.
The guidance, approved by the Department for Business, Innovation & Skills' Better Regulation Delivery Office, argued bathroom provision at food outlets should be based on a predominant trade test.
Officials said, that if "takeaway trade was predominant" food and drink would not "normally" be sold for consumption on the premises, and outlet owners should therefore not be required to provide toilet facilities.
Hull City Council said that approach could not be right, as such an interpretation gave the two Greggs' bakeries in Hull an "unlawful and unfair" commercial advantage.
In his ruling at a hearing in Leeds on Tuesday, Mr Justice Kerr said Hull council's claim was "well-founded" and the advice given by Newcastle council "flawed".
He said he would quash the Better Regulation Delivery Office's decision to approve Newcastle council's guidance.
The judge added: "It is obvious that if a person sits down in a Greggs outlet at the seats provided and proceeds to eat a pasty and a fizzy drink just purchased at the counter for that purpose, that is a normal use of the premises.
"The fact that most customers take away their purchases and those who stay do not normally stay long, does not change that."
A Department for Business, Innovation & Skills spokesman said: "We have lodged an appeal."
Responding to the latest ruling, a Greggs spokesperson said: "This is the first time the statutory Primary Authority scheme as set up in 2008 has been challenged in the courts.
"Until this matter has been finally determined by the courts it would not be appropriate for us to comment."
The firm said it expected a final decision within the next nine months.