Chazal observe that twice in Parshas Vayechi the Torah refers to Yosef and his sons, Ephraim and Menashe, as not being subject to the negative impact of an ayin hara - an "evil eye". Yaakov blesses Ephraim and Menashe that they should multiply like fish - just as fish are not seen as they swim underwater (either due to their depth or due to refraction), so too the descendants of Yosef are protected from those who may look at them with an ayin hara. Yosef receives his personal blessing from Yaakov and is described as one who is "alei ayin - above the eye". This blessing also acknowledges that Yosef is not influenced by the evil eyes that surround him. What is the significance of ayin hara and why are Yosef and his children immune from its negative influence?
Ayin hara can be understood to be synonymous with jealousy, which begins when one looks at what others have. A jealous person both wants the desired object for himself and does not want the other person to have it. As such, his looking at others with negativity is literally an ayin hara. Yosef, of all people, seems to be the most impacted by the ayin hara of jealousy. In Parshas Vayeishev we learn that "vayir'u echav - his brothers saw", i.e. they saw the favoritism symbolized by the kesones passim, and this led to their jealousy and the extreme ayin hara with which they viewed, and dealt with, Yosef. How does Yosef, the man whose brothers sold him into slavery due to their jealousy, eventually become the one who no longer has to ever worry about this powerful ayin hara of jealousy?
The trait of jealousy which manifests itself in our relationship to our fellow man emanates from a deficiency in our relationship with Hashem. "Kol mah d'avid rachmana l'tav avid - whatever Hashem does is for the good". A sincere belief in the ultimate goodness even of what appears evil enables a person to look at everyone and everything with an ayin tov - a good eye. One who fully internalizes this perspective and thus views everything in life positively will never be jealous of others because he never views himself as lacking anything.
Throughout his life, Yosef exhibited tremendous optimism. In every difficult situation he makes the best of his lot and succeeds to whatever degree he can notwithstanding the challenges that face him. What is the source of this powerful positive outlook that enables Yosef to survive his brothers selling him into slavery and later his imprisonment for false accusations? How does he cope with the pain of being forcibly separated from his father and the difficulties of surviving alone in a foreign land?
The Torah reveals this secret of Yosef in one of his last conversations with his brothers. They are frightened that upon the death of Yaakov, Yosef will punish them for all that they had done to him. With tears in his eyes, he consoles them saying, "Elokim chashva letova - Hashem planned it for the good". These were the words that kept Yosef positive throughout all of his ordeals; he truly believed that at every moment of his life, Hashem was planning for the good. Yosef's genuine belief in "Kol mah d'avid rachmana l'tav avid" left no room for negativity in his heart. Watching others prosper didn't induce jealousy because Yosef truly believed he was receiving only the good of Hashem. "B'mida she'adam moded kach modidin lo - the way one acts to others is how Hashem responds to him". One who never exhibits an ayin hara to others because everything is for the good is not subject to the potential affects any ayin hara directed towards him.
Yosef, despite having initially suffering greatly jealousy-driven actions of others, emerges as one who is immune to the effects of the ayin hara of others due to his lifelong commitment to always seeing the good of Hashem in everything. This lifelong commitment and avodah transformed Yosef and his descendants into people who were "alei ayin" - above and immune to the jealous eyes of others.