The reason cities vary randomly in mailing addresses is that the third line of your mailing address:
YOUR NAME
123 YOUR STREET
NOT-YOUR-TOWN, STATE ZIP
is not the name of any city at all, it's the name of the post office from which your mail is delivered. The post office will shuffle addresses between ZIP codes based on what makes for an efficient delivery route -- it has nothing to do with municipalities.
The mismatch is especially common in areas which used to have dozens of post offices which have now been either shut down or downgraded to PO box-only offices, and all home delivery has been consolidated to a single post office for cost efficiency.
Correct. I've heard that it varies depending upon your location. For example St Paul, MN was massive when it was set up so most of the eastern suburbs of the Twin Cities have St Paul MN, 5XXXX rather than the actual city.
Municipalities assign the rest of the address (street name, house number etc) and are responsible for that mess.
The mismatch is especially common in areas which used to have dozens of post offices which have now been either shut down or downgraded to PO box-only offices, and all home delivery has been consolidated to a single post office for cost efficiency.