I don’t know if there’s more to it but distance travelled is certainly taken into account – In fact you’ll want to take advantage of that for industry. Never sell your goods or raw materials to a nearby industry if you can reach one further away.
This is where the high train maintenance costs really come into play – Making short lines is a great way to turn an otherwise profitable route into a money sink. The (large) amount of stuff moved back and forth is just done too cheap to earn you any profits.