It's really pretty basic.
If you have a "standard" B777-300 with maximum payload, you cannot carry full fuel within Maximum Takeoff Weight limits, thus the range is limited.
If you want to carry the same payload in essentially the same aircraft for a greater distance you require to carry more fuel, and thus operate at a greater Maximum Takeoff Weight.
Apart from structural considerations, the only way to increase the Maximum Takeoff Weight is to add BIGGER engines.
The MTOW difference between a standard B777-300 and B777-300ER is approximately 30 tonnes, thus, for the same payload you may carry an additional 30 tonnes of fuel. This provides the longer range.
Regards,
Old Smokey