משך חכמה
Meshekh Chokhmah, Vayeshev:8
Q — Why would anyone bless Yehudah for selling Yosef, and why is doing so considered ניאוץ of Hashem?
A — The OUTCOME of the sale was the saving of Israel from famine and the fulfillment of brit bein habetarim — but the INTENTION was evil; anyone who praises an act based only on its result while ignoring the corrupt intent is מנאץ ה', because Hashem cares about both — which is why עבירה גוררת עבירה דוגמתה led Yehudah straight into the parallel case of Tamar (good outcome of the malchut, bad intent of seeking a zonah).
הכוונה שהמעשה היה תכלית הטובה, שירד יוסף למחיה לפניהם ולהקים שבועת בין הבתרים, אך הם חשבוה לרעה כאשר אמר להם יוסף... ולכן נכשל במעשה דתמר, שעבירה גוררת עבירה דוגמתה.