
David W. answered 04/22/20
Experienced Prof
Gen 39:21 But the Lord was with Joseph and showed him steadfast love and gave him favor in the sight of the keeper of the prison.22 And the keeper of the prison put Joseph in charge of all the prisoners who were in the prison. Whatever was done there, he was the one who did it. 23 The keeper of the prison paid no attention to anything that was in Joseph's charge, because the Lord was with him. And whatever he did, the Lord made it succeed.
The key phrase, "the Lord was with Joseph." is very important.
Gen 40:4 The captain of the guard appointed Joseph to be with them, ... 8b And Joseph said to them, “Do not interpretations belong to God? Please tell them to me.” -- Joseph correctly interpreted their dreams; this led to Pharoah calling for Joseph to interpret his dream.