Most phrases like "il mio cane" for instance have "mio" before the noun. Why is it after it in "casa mia"?
The postponed possessive is used only in rare cases: for instance caro mio is quite different from mio caro
caro mio, non si fa così (exhortation)
mio caro, ti scrivo da Milano (start of a letter)
Similarly, the exclamation is mamma mia!, not mia mamma!.
The phrase casa mia can be translated into English with my home, while la mia casa would be my house. Note the missing article: casa mia is not a building that can be distinguished from other ones, it's the place where I live, so it's unique.
The postponed possessive can also appear with the article: il mio paese is pretty much the same as il paese mio, perhaps the latter shows more affection. Such inversion can also depend from regional usage. However, casa mia (without the article) always has the meaning explained above.
When the possessive adjective follows the noun it carries an emphatic or emotional meaning*.
As in the following:
Andiamo a casa mia!
There is even a very early instance of devotional poetry from Jacopone da Todi (1230 - 1306) with a flipped possessive:
Figlio, chi dà consiglio al cor mio angustiato? (Il Pianto della Madonna)
The al cor mio being al mio cuore has a personal emotional meaning.
However, this does not account for the occurrences of casa mia where there is seemingly no emphatic or emotional meaning, as in:
Lui abita vicino a casa mia
Perhaps, over time, the emotional sense of casa mia just became the expected usage, or maybe the emotion of my home is always present:
Casa mia, casa mia, per piccina che tu sia, tu mi sembri una badia.
*Reference: Routledge Modern Italian Grammar § 3.7.2