I believe many rappers do this to show that they take pride in where they come from, regardless of where it is. Without that place where they grew up, they wouldn't have gotten to the place they are today. That's why I don't feel that rappers who reference their towns, or shoot music videos in their hometowns is a bad thing. They are allowed to take pride in their past, and if anything, the town can benefit from exposure to the world.
One instance of a rapper taking pride in his city is when Jay-Z raps about New York City in his track "Empire State of Mind." He talks about how he grew up in Harlem, the places he traveled to in his childhood, and then how he is living his life now. He went from the streets of Harlem to sitting front row at the Knicks and Nets games. Jay-Z takes great pride in his city, and he raps about how great of a place it is in his track "Empire State of Mind."
"Empire State of Mind" Lyrics