Okay. I think I got it.
your pokemon's Stats (except for HP) are determined using this formula:
IV-Your pokemon's IV value for that stat
B-Your pokemon's base stat. (For instance, Mew has a base attack of 100)
EV-The number of EVs your pokemon has in that stat.
L-your pokemon's level
Nature-If your pokemon has a beneficial or hindering nature.
By lowering your pokemon to level 50, that lowers the value in the equation, lowering their stats. but they return to normal after the battle of course.