Quran 12:50. The king said, “Bring him to me.” And when the envoy came to him, he said, “Go back to your master, and ask him about the intentions of the women who cut their hands; my Lord is well aware of their schemes.”
51. He said, “What was the matter with you, women, when you tried to seduce Joseph?” They said, “God forbid! We knew of no evil committed by him.” The governor’s wife then said, “Now the truth is out. It was I who tried to seduce him, and he is telling the truth.”
52. “This is that he may know that I did not betray him in secret, and that God does not guide the scheming of the betrayers.”
53. “Yet I do not claim to be innocent. The soul commands evil, except those on whom my Lord has mercy. Truly my Lord is Forgiving and Merciful.”
54. The king said, “Bring him to me, and I will reserve him for myself.” And when he spoke to him, he said, “This day you are with us established and secure.”
55. He said, “Put me in charge of the storehouses of the land; I am honest and knowledgeable.”
56. And thus We established Joseph in the land, to live therein wherever he wished. We touch with Our mercy whomever We will, and We never waste the reward of the righteous.
57. But the reward of the Hereafter is better for those who believe and observed piety.
58. And Joseph's brothers came, and entered into his presence. He recognized them, but they did not recognize him.
59. When he provided them with their provisions, he said, “Bring me a brother of yours from your father. Do you not see that I fill up the measure, and I am the best of hosts?”
60. “But if you do not bring him to me, you will have no measure from me, and you will not come near me.”
And here's the commentary.
These are the words of Joseph, who explains his conduct in preferring to remain in prison until his innocence was established.
These are also the words of Joseph. When a man addressed Jesus as good master, he said: “Why callest thou me good?” (Mark 10:18). The righteous never attribute any good to themselves, but attribute all good to the Great Source of goodness — God. Man’s self is here called ammårah, i.e. one wont to command evil. It is, in fact, the lowest stage in the spiritual growth of man. It is what may be called his animal self; low desires and animal passions rule the mind of man and he is capable of doing any evil without feeling any pangs at all. He submits to his carnal desires like the brute. The next stage is called the lawwåmah, which is referred to in 75:2 as the self-accusing spirit, when the slightest departure from the path of rectitude at once rouses the pangs of conscience. The third stage is the stage of perfection — the mu∆ma’innah, or the soul at rest, when it is in perfect peace, having attained the goal of perfection. Those who have attained the second stage in the spiritual advancement and those who have attained the goal of perfection are spoken of as those on whom my Lord has mercy.
Joseph didn't want to be "pardoned". He wanted to be "cleared of all charges". He was innocent.... sure he might have wanted to play along with Potiphar's wife.... but he kept his carnal feelings in check. He didn't want to be "free" until he was "free and clear".
So... Pharaoh met with Joseph. Potiphar's wife confessed to being a liar.... and lusting after Joseph. Potiphar's wife confessed to attacking him and then when he wouldn't play along.... she accused him of what she was doing.
I don't think they were as legalistic as we are. I doubt Joseph threatened to sue for liable and false arrest. I think, after years in prison, he was just feeling lucky. Maybe that's why he told Pharaoh he would be the perfect person for watching over the storehouses. In the dream he interpreted for Pharaoh, the storehouses had to be controlled because a famine was on the way. If he could keep his thing in his pants with Potiphar's wife all over him.... he could be trusted.
I find it interesting..... the Quran story describes the three phases of man's quest for perfection. There's the animal lust.... self control.... then a soul at peace.
Peace.... floating.... peace.... calm.... that's the goal.
Yep... he was lucky.... Pharaoh put him in charge of the storehouses..... which lined him up to receive his brothers when they came to negotiate for some food to take back to the family. They didn't recognize him. Why would they? They bought their own lie.... they thought he was dead by now. They didn't expect Pharaoh to put Joseph in charge of the treasury! Now he wants to see Benjamin and Jacob. Oh... those boys should not have thrown their brother in the pit.... they had no idea what they were in for when they traded him away. When he left as a slave with the caravan.... they thought they had seen the last of him.
Animal lust got the best of them.