I notice adding protection IV to mending costs 2 but adding mending to protection IV cost 4.

Is there a reason there is a cost difference? or should i always just pick the lowest cost possible and not worry about it?
Combining enchanted books in anvil