I am guessing it has to do with inferred speed of the road segments. When looking at your linked example if you use custom model under settings for that GraphHopper route and increase the "distance_influence": from default of 15 to say 30 then it does the shorter route. The two routes are very close in distance, but the routing engine is determining the one you consider "less optimal" to be slightly faster. It is a very long exit/entrance ramp, if the routing engine defaults the ramp to a slower speed then it may think that route is slower.