SR4 has a point-based character creation, where playing an elf costs 30 BP (out of 400) and playing a troll costs 40 BP.
The Runner's Companion (for SR4) introduced a priority system, where you have to choose a priority for your heritage, which includes your metatype and give special attribute points to spend to increase your Magic / Resonance / Edge attribute.
SR5 did "fix" this, since trolls need a A or B priority (and has a 100% lifestyle increase that they didn't have before), while elves only need a D now.
As for the reason behind SR3 and SR4 choice, I suspect it has to do with the elves being the only race providing an increase of character's charisma, and a good one; charisma being impossible to increase with cyber/bio ware, it's quite an advantage.
There are numerous forums about SR optimization pointing that a Voodoo Elf breaks the game in half, precisely because of his 8 charisma (which means 8 bound spirits, at least in SR4) and high drain resistance.
They are, as you said, immortal and well accepted in the world, and have a country of their own, which doesn't matter in most SR campaign but still.
And as Kyle Willey noted in the comment, elves don't suffer any attribute loss, they're simply better than any human could be, while trolls suffer penalties on half of the attributes. Maybe they realized in SR5 that wasn't enough to balance the +4 STR and +4 BOD.