The distance of a route is calculated as the sum of all the small distances of each segment. The curvature of the Earth is taken into account, but not the difference in altitude (mountains and hills).
Question: Why is the effect of the mountains and hills not taken into account for the distance calculation? Answer: Only when you have very steep slopes for a long distance, the effect is significant.
Example: an average slope over a long distance (e.g. 100km) of 10% is very exceptional. But suppose it is, than the difference on every 100m is less then 0,5m. So, if you would cycle 100 km (planigraphic distance), your 'real' distance would be 500m extra.