For the Vancouver False Creek anchoring rules, I think it took a specific amendment to the Canada Shipping Act to get the rules passed.
I doubt Nanaimo has a legal case if it went to court - but I suspect few derelict boats would challenge the law.
Of course who would really want to stay in Nanaimo more than 2 weeks anyway