It's a good question. You could argue that the position of the line times the number of rated miles gives an approximate value for the pack capacity. But I have no idea whether that's the reason Tesla chose that position. And it's a bit odd that the difference in position vs. the value used for the calculation is always 5Wh/mi no matter what the underlying number of rated miles available for the vehicle.
The reason it would have to be 5Wh/mi higher on the AWD/RWD is because of the buffer. The 310 rated miles above the buffer effectively contain less energy than the true EPA rated miles - because the EPA miles include the buffer energy, but the rated miles on the gauge do not.
Anyway, for example:
310rmi * 250Wh/rmi = 77.5kWh
325rmi * 239Wh/rmi = 77.7kWh
But to be honest, this is just throwing random numbers around and I have no idea why Tesla does what they do. It does make things fantastically confusing!
The charging and discharging constant discrepancy is honestly the biggest confusing point - people claim it is due to heat loss, but honestly haven't seen a lot of dependence on the discharge rate. But regardless of the reason, it means that your trip meter kWh will always be significantly less than your charging screen kWh additions.
But in any case the projected range starts out about right at 100% battery, and when you get to just a few %, it's actually potentially pessimistic, because it's not accounting for the buffer (which is probably good since you really probably don't want to dig into that...)