You can tell that Joseph loves every minute of it. He does not simply identify himself to his brothers. He drags out the process, first making them go back to get Benjamin, then treating them to a feast and free rations to take home, only to plant his silver goblet in Benjamin's bag so as to make them think that he had caught him stealing. He instructs his servant to overtake them, find the goblet, and then storm: "Why did you repay good with evil?...It was a wicked thing for you to do!" (Genesis 44:4-5). He then announces that he will take Benjamin as a slave, feigning to be magnanimous in not enslaving them all. It is only after Judah suggests that he become Joseph's slave in Benjamin's place that, in next week's reading, "Joseph could no longer control himself" and he reveals his identity to his brothers.
This is vengeance of the first order. It is getting even with them on many levels - for reviling him for his dreams of superiority, for throwing him in a pit and selling him into slavery in Egypt, and, as Judah tells him in the opening of next week's Torah reading, for deceiving Jacob about Joseph's fate. He now not only gets even; he gets to lord it over them and to scare them to boot.
One could say that this is yet another example of how the Torah depicts people with all their flaws. Even though Joseph is clever and powerful, second only to Pharoah in the command of Egypt, he is ultimately a petty, vengeful man. Later the Torah will prohibit just such behavior: "Do not take vengeance or bear a grudge against your countrymen. Love your fellow as yourself: I am the Lord" (Leviticus 19:18).
And yet is this not justice? After all, even though Joseph irked them through his haughty dreams and his favored status with their father, Jacob, ultimately the brothers sold him into slavery and deceived their father to cover it up. Surely they deserved some punishment for what they did.
In fact, part of what we generally mean by justice is retribution. "But if damage ensues, the penalty shall be life for life, eye for eye, tooth for tooth, hand for hand, foot for foot, burn for burn, wound for wound, bruise for bruise" (Exodus 21:23-25), the Torah says. Granted that the Mishnah later made it virtually impossible to carry out the death penalty (M. Makkot 1:10) and that it transformed these modes of retribution into compensation (M. Bava Kamma 8:1), still the standard of justice is lex talionis, the law of fitting the punishment to the crime in an attempt to achieve an exact balance of one for the other. That, in the view of both the Torah and the Rabbis, is justice. So how is justice different from vengeance such that the former is praised and the latter condemned?
Several things mark the difference. First, justice is meted out by communal authorities - courts and/or kings in the ancient world - while the vengeance banned in Leviticus 19 is that of individuals against each other. The presumption is that the court or king will be neutral and fair in deciding whether punishment is warranted and, if so, what it should be. Judges therefore, according to Mishnaic law (M. Sanhedrin 3:4), may not be related to each other or to the accused or litigants. In our story, Joseph is indeed a high government official, but he cannot judge fairly because he is closely related to the culprits. Indeed, that is what makes his ability to torment them so delicious for him.
Second, justice requires that people be treated fairly - that is, that everyone be subject to the same rules. Those taking revenge, by contrast, decide by themselves what they think is appropriate to do to get even with the particular person or people from whom they are wreaking vengeance.
Finally, the agents and motives of justice and vengeance differ radically. Justice is meted out by neutral governmental authorities. Judges may be upset that they must inflict punishment on particular offenders, but if they are unrelated to them, as they should be, the judges' motivation will not be to harm particular people but rather to uphold the law so that society can live in peace.
In contrast, vengeance is inflicted by victims or their families or friends. Vengeance is therefore much more personal. As such, it can eat up the person who bears a grudge and seeks vengeance, sometimes to the point of making gaining revenge the focus of their lives.
The vengeance that Joseph wreaks on his brothers in this story, then, delicious and even fair as it may seem, should also alert us to the crucial difference between vengeance and justice. It should also remind us of two of the Torah's commands: "Justice, justice shall you pursue" (Deuteronomy 16:20), but "Do not take vengeance or bear a grudge against your countrymen. Love your fellow as yourself: I am the Lord" (Leviticus 19:18).