I'm working on some projects for the city of Amsterdam, by default all we develop is open source.
But whether this is a legal issue is actually an open debate, in some specific cases companies could potentially sue Amsterdam for sharing solutions with other governments and thereby "competing" with the market. How a judge would rule is not clear. But this is something they are aware of and it's a risk. It seems to also be connected to the way the project is shared.
As far as I know they are looking into changing the law on the national level so this stops being a problem. Also strangely enough, I've been told, as soon as the project gets funded by the EU, this law is not applicable anymore.
Open source means published on github, not many projects are actually properly documented.