Under United States copyright law, according to the Copyright Office,
206.01 Edicts of government.
Edicts of government,
such as judicial opinions, administrative
rulings, legislative enactments, public
ordinances, and similar official legal documents are not copyrightable for reasons of
public policy. This applies to such works
whether they are Federal, State, or local as
well as to those of foreign governments.
Referencing laws is even clearer: copyright doesn't protect referring to something like "Section 830 of the Penal Code of the State of California." Note that this is assuming that they remain within the US, where copyright law is a federal issue. Other countries don't all have the edict of government rule.
If a place were to legally secede and become their own country, they would cease to be bound by US copyright law. They would get to decide if it was legal for them to do it or not; this is just like how it works between the UK and US (the UK claims copyright on its laws, but US courts will not enforce that copyright because it's incompatible with US law). Treaties complicate things, but the Berne Convention allows the edict of government exception.
That said, seceding from the US unilaterally is both legally and practically impossible; seceding from a state is likewise generally going to be legally and practically impossible without permission from the state. So, it all depends on the agreements made.
To specifically address the model codes issue, Veeck v. S. Bldg. Code Congress Int’l, 293 F.3d 791 (5th Cir. 2002) was a case specifically about what happens when model codes are adopted wholesale into law. The Fifth Circuit (after initially finding that the model codes were protected) reversed en banc, finding that a model code produced for the purpose of being incorporated into law, and which has been incorporated into law, and which is then reproduced as the law of the place that incorporated it into law, is not subject to copyright.
Veeck may not apply to cases where the law merely references the model code, or where the thing in question was not made to be incorporated into law (e.g. state laws referencing the Red Book valuation of a car didn't make the Red Book public domain). If both of those are true, it probably doesn't apply; if one holds but not the other, it's unclear. However, if the actual municipal code directly contains the text of the model code, and you reprint it as the law of that municipality (rather than as the model code), there is no copyright in the law.