I always assumed living in a professor's town was akin to living near a good school or institution as a family. Typically, the protagonist in the games has just moved to the town, such as in Gen 3 and Gen 6, probably because the trainer's parents were planning for their child's future as a trainer, as a family would plan for its child's future by moving to a good neighborhood and school district. We see in Gen 3 and 6 that the families of our protagonist are very pokemon - centered, as in Hoenn the protagonist's father was a gym leader of a nearby town, and in Kalos, our main character's mother is a Ryhorn racer. Though in gen 6 the trainer's family did not move into the city where the professor is located, Lumiose city, they still moved into an area where the professor had an area of influence through his many pupils. As some have previously said, it is demonstrated in Hoenn that children can receive pokemon through the help of gym leaders. Just my two cents, hope it helped!