"Is not this the one from which my lord drinks, and from which he indeed divines?" (Genesis 44:5). "And they rent their garments, and each man loaded his ass, and they returned to the city" (Genesis 44:13). The Holy One, blessed be He, said to them: You caused your father's garments to be rent over a worthless matter; so too shall you rend your garments over a worthless matter. "And each man loaded his ass" (ibid.) — not one of them had need of his ass. And they stood and beat Benjamin upon his shoulders and said to him: "Hey, thief, son of a thief! You have shamed me. You are your mother's son. Thus did your mother shame our father" — "And Rachel stole the teraphim" (Genesis 31:19). By virtue of those blows with which they struck him upon his shoulders, he merited that the Shekhinah rested upon his shoulders, as it is said: "And He dwells between his shoulders" (Deuteronomy 33:12).
Why the Brothers Struck Benjamin and the Shekhinah Rested on Him
Midrash Tanchuma Buber, Miketz 13:5
הלוא זה אשר ישתה אדוני בו וגו' (בראשית מד ה), ויקרעו שמלותם וגו' (שם שם יג), אמר להן הקב"ה אתם הקרעתם בגדי אביכם בדבר של חנם, כך אתם תקרעו בדבר של חנם, ויעמוס איש על חמורו (שם), לא הוצרך אחד מהן לחמורו, והן עומדין ומחבטין לבנימין על כתפיו ואומרים לו, אי גנב ברה דגנבתא ביישתני בן אמך את, כך היא ביישה (אמך) את אבינו, ותגנוב רחל את התרפים (שם לא כ), בזכות אותן המכות שהכתוהו על כתפיו זכה ושרתה שכינה על כתפיו שנאמר ובין כתפיו שכן (דברים לג יב).