The Torah portion Vayeishev relates at length about Yosef's trials and tribulations in Egypt, first being forced into slavery and then incarcerated in an Egyptian prison. In both instances G-d was with Yosef, blessing him with good fortune.
The Torah, however, clearly distinguishes between his good fortune as a slave and his good fortune as a prisoner: With regard to the former, the verse states: "and G-d made it so that all he did was favored with good fortune - matzliach - in his hand." With regard to Yosef's fortunes as a prisoner, the verse merely states: "and that which he did, G-d favored with good fortune," deleting the term "in his hand."
Why do the verses differ?
The Tzemach Tzedek explains that the word matzliach means good fortune - something granted as a gift from above, independent of a person's own labor.
There are, however, two kinds of "luck": One is realized within and through a man's actions. For example, a person who succeeds at whatever he does owes his continued success to G-d's ongoing gift.
There is, however, an even greater kind of luck, wherein the reward for a person's labor is so out of proportion to the effort expended that one can immediately perceive G-d's hand at work.
Herein lies the difference between Yosef's two kinds of luck: During the time that he was a slave, the verse states: "G-d was with Yosef, and he was a man of good fortune"; the success was ascribed to Yosef. When Yosef was jailed, however, the verse states: "and that which he did G-d favored with good fortune"; whenever Yosef would do something, his success was so astounding that G-d's hand was immediately discernible.
Why was it that when Yosef was merely a slave his luck was of a lower order, yet when he underwent the further degradation of becoming a prisoner his luck became greater?
The prerequisite for supernatural success is self-abnegation, as the verse states: "To this one I will look - to one who is poor and of crushed spirit." The less cognizant a person is of his own ego, the more G-d will be with him, and the more will G-d's might be perceived in his actions.
Herein lies the basic difference between slavery and incarceration. While a slave is wholly subjugated to his master, he still retains a sense of dignity and self; he is able to accomplish meaningful work, and so on.
A prisoner, however, is nothing more than a number, and cannot develop or even employ his talents; a prisoner loses all sense of self-esteem.
Yosef's slavery enabled him to achieve an appropriately profound state of humility. In turn, "G-d was with Yosef and he was a man of good fortune... and G-d made it so that all he did was favored with good fortune in his hand."
Nonetheless, since Yosef the slave still retained a sense of self, his success was limited to such divine good fortune as was clothed in, and thus necessarily bounded by, "his hand" and actions.
Yosef's incarceration, however, created a state of utter nullification before G-d, to the degree that he lost all feeling of personal ego. The success he then enjoyed was therefore entirely superhuman - "and that which he would do G-d would favor with good fortune."
Yes, Yosef's success even now remained based upon his actions, but since Yosef exhibited total self-abnegation, his actions in no way impeded his luck. Thus, the rewards were no longer limited by the hand of a limited being, but were divinely boundless.
Compiled from Likkutei Sichos, Vol. XXV, pp. 213-216.