His sons were brought up with truth and justice. The whole family went by the book. But sometimes we can be so truthful that we leave no room for compassion. Yosef's brothers needed to acquire the attribute of compassion. G-d's compassion went into action.
Some people follow all the rules carefully.
Yet in a way following the rules is the easy way, the path of least resistance. Following rules requires no deep thought or decision-making, no soul searching and no stretching beyond oneself. There are other people that never break a rule yet they have the ability to can go beyond the rules. When the brothers sold Yosef down the river they may have been right. They may have gone by the book.