French Town Halls

Could anyone tell me the difference between a “Mairie” and a “Hotel de Ville” in a French town?. Both seem to be concerned with local government.Does the size of the town determine which of these buildings there will be or are there other factors?. In paris there is the main “Hotel” but every Arrondissment seems to have a Mairie.

I think technically, the Mairie is where le Maire lives - the mayor. And l’Hotel de Ville is just the town hall. I suppose in some places the two may actually be the same building (don’t know how that correlates with town size though), and I can also imagine that the two words are used somewhat interchangably.

And now I’m having doubts whether or not “interchangably” is a word. :wink: