It’s all about competition. Different routes of the same distance cost different amounts generally not because they cost different amounts to operate, but because of how much the competitors are charging. This is part of why flights into small airports are so expensive because they lack competition.