If any of you have noticed, most Pokemon have EV giveaways according to their evolution and best stats - for example, Charizard gives 3 Special Attack because its best stat is SP. ATT., and it is at its 3rd evolutionary stage(so the total is 3 EVs), Lucario gives 1 Attack as well as 1 Special Attack because they are its best stats, and Lucario is at its 2nd evolutionary stage(so the toal is 1+1=2 EVs)
Therefore Rampardos gives 2 Attack because it is at its 2nd evolutionary stage.
I know all Pokemon don't give EVs in this way but this is what I've noticed and I think this is the best possible expaination.
Other than that, there is always GF Logic.