Far from it. For God rules all things by His providence in such a way that He remains pure and free from all sin. The end and goal that one has in mind determines whether an action is good or evil. God has in all His works an end and goal that is in keeping with His eternal and immutable righteousness. People, however, sin, because in what they do and fail to do they transgress or deviate from the will of God and the obedience to Him that He demands of us in His Word.
Joseph’s brothers had a different end and goal in view than did God: “You meant evil against me,” says Joseph, “but God meant it for good, in order to bring it about as it is this day, to save many people alive.” (Genesis 50:20)
When Job was being plagued, the Evil One had as his goal to defame God the LORD and to drive Job to despair. The Chaldeans had as their goal to become rich from their robbery. God, however, worked in this whole incident in such a way that He preserved the faith and patience of His servant Job, made manifest His own glory, and in the end rescued Job, to the humiliation and disgrace of Satan.
David, too, recognized that God was acting according to His righteousness through Shimei when he said, “Let him alone; God has ordered him to curse me.” (1 Samuel 16:11) But in that very same act David judged that Shimei had sinned grievously (1 Kings 2:8), and even Shimei confessed this (2 Samuel 19:19)
8 Behold, there is with you Shimei the son of Gera the Benjamite, of Bahurim; now it was he who cursed me with a violent curse on the day I went to Mahanaim. But when he came down to me at the Jordan, I swore to him by the Lord, saying, ‘I will not put you to death with the sword.’ 1 Kings 2:8
And Shimei the son of Gera fell down before the king as he was about to cross the Jordan. 19 So he said to the king, “Let not my lord consider me guilty, nor remember what your servant did wrong on the day when my lord the king came out from Jerusalem, so that the king would take it to heart. 20 For your servant knows that I have sinned; therefore behold, I have come today, the first of all the house of Joseph to go down to meet my lord the king.” 2 Samuel 19:19, 20
The reason is that God knew very well how to use an evil instrument and tool to humble David so that David would honor God as just and merciful. Shimei, however, had quite another goal of his action in view, a goal contrary to the will and law of God. Because the shortcoming and sin in Shimei (the “tool”) was also discovered, he was finally punished by the wonderful providence and judgment of God. (1 Kings 2:36, 44)
Now the king sent and called for Shimei and said to him, “Build for yourself a house in Jerusalem and live there, and do not go out from there to any place. 37 For on the day you go out and cross over the brook Kidron, you will know for certain that you shall surely die; your blood shall be on your own head.” 1 Kings 2:36, 37
39 But it came about at the end of three years, that two of the servants of Shimei ran away to Achish son of Maacah, king of Gath. And they told Shimei, saying, “Behold, your servants are in Gath.” 40 Then Shimei arose and saddled his donkey, and went to Gath to Achish to look for his servants. And Shimei went and brought his servants from Gath. 41 It was told Solomon that Shimei had gone from Jerusalem to Gath, and had returned. 42 So the king sent and called for Shimei and said to him, “Did I not make you swear by the Lord and solemnly warn you, saying, ‘You will know for certain that on the day you depart and go anywhere, you shall surely die’? And you said to me, ‘The word which I have heard is good.’ 43 Why then have you not kept the oath of the Lord, and the command which I have laid on you?” 44 The king also said to Shimei, “You know all the evil which you acknowledge in your heart, which you did to my father David; therefore the Lord shall return your evil on your own head. 45 But King Solomon shall be blessed, and the throne of David shall be established before the Lord forever.” 46 So the king commanded Benaiah the son of Jehoiada, and he went out and fell upon him so that he died. 1 Kings 2:39-46
From this incident one can easily see that everything happens by the providence of God and that still He remains pure from all sin, which belongs to the Devil and perverted human nature.
Caspar Olevianus, A Firm Foundation, pp. 24, 25