Shabbat Mikeyts: Was Joseph Fair?
One answer is that he needed to be sure that the brothers who had sold him would be able to accept his lordship and had repented for their treatment of him. Nachmanides, responds that Joseph had by now realized that his position of power was both a fulfillment of his dreams and that his suffering had been part of a wider scheme that God had for him in which he was merely an agent. He felt his behavior was also part of that plan to purge the past. Another explanation is that repentance can only be completed when a person is placed in the exact position as one was when one did something wrong and was able to act differently. The brothers having abandoned Josef to his fate the first time, had to prove by not abandoning a brother the second time, that they had changed.
Which leads to another issue. Why didn’t the brothers realize earlier that this viceroy was playing games? Why did he ask about their father? Why ask for Benjamin? Why send their money back with them? Why arrange their seating at his table according to their ages and give extra presents to Benjamin? Were they so burdened with guilt they could not connect the dots?
You could argue that Joseph’s cruelty reflected theirs. They had no idea how much he had suffered before he managed to become the powerful man he was. This is a story of the law of unintended consequences. Even if things do turn out for the best, the process of suffering can go on for a long time and change a person. Similarly, genuine repentance requires a complete transformation that may take a long time.
Much later on, even after the reconciliation, the brothers still feared that Joseph would retaliate after their father died and needed reassurance. Both cruelty and guilt can be very debilitating. A complete transformation is the only cure.