Generation IV note
Usually, a Pokémon gains stat points when they level up, based on the amount of effort points that the Pokémon has acquired through battle, and based on its own [[Stats#Base Stats|base stats]]. But by depositing a Pokémon into the PC and withdrawing it, the game will, in the process of depositing/withdrawing, recalculate the stats of the deposited Pokémon based on the amount of effort points etc. it possesses. The reason it does this is because while in the box the actual stat values are not stored, so they must be calculated when taken out or viewed.