Couple of things I would like to clarify, which I guess could be called more of an addition to Pyritie's answer since the question was tagged to address Pokémon from not just one generation.
I'm playing Pokemon FireRed, and I want to get a Nidoran from an egg. This little Nidoran will be level 5.
Note that this happens in FireRed/LeafGreen and games before it. Any games that got released later have Pokémon hatching at level 1.
When you put a Pokémon in first position and then you change it in combat, this Pokémon will get half the earned experience. If its level is much lower, it will get a lot of experience and level up fast (fast method).
This has also changed in recent games. As from Black/White, if two Pokémon battled the same opponent and win, the Experience gained will not be equally shared between the two Pokémon, but the lower leveled Pokémon will get higher Exp. The reason why you might see something a bit similar in FireRed is that lower level Pokémon require less Exp to level up (for the Nidoran lineup, the change is roughly cubical, i.e. it follows a trend similar to requiring 1, 8, 27, 64, 125 exp each time it levels up).
To your question now, yes, what only matters for your Pokémon to get their final stats (considering only their training) is the type and amount of Pokémon they get Exp from. The level or amount of Exp received does not have any effect.
To illustrate, if your Nidoran battles 40 Rattata on its own, it will get 40 Speed EVs (that basically represents 10 more points in the speed stat). If the same Nidoran had battled 40 higher leveled Rattata but you always switched for another of your Pokémon to take it down, both your Nidoran and your other Pokémon would get the 40 Speed EVs.
Personally, I like to give my Pokémon vitamins once I can get a constant supply of Pokédollars. Each vitamin can up a particular stat by 10 EVs to a maximum of 100, which is already a lot!