It's actually not dependant on location. It's dependant on Magikarp's personality value.
I'll try to make sense of the calculation:
Personality values are assigned by a 32 digit bit that determine some characteristics of the Pokemon. They are split into 4 different parts. (00000000 00000000 00000000 00000000). For the calculation of how big a Pokemon is, the last 2 parts are used.
The formula to calculate a portion of the size is:
>s = ( ( (Atk' ⊕ Def') HP' ) ⊕ p1 ) 256 + ( ( (SpAtk' ⊕ SpDef') * Spd' ) ⊕ p2 )
Where p1 is the last 8 %256, rounding down, while p2 is the second to last eight digits divided by 256 and then taking the modulo.
Then, the s you obtain is used to obtain the an x, y, and z values:
Afterward, using the obtained values, as well as h, the Pokemon's height in meters rounded down:
>Size = Rounddown( (s-z) / y + x ) * h / 10
td;lr: It's pretty much luck, although if you can manipulate RNG somehow, you might get better luck.
Source
And by the way, it's Lake of Rage, not Mahogany Town :)