This is an "old chestnut". We observe the following:
Lam 3:38 - Do not both adversity and good come from the mouth of the
Most High?
The idea of the Divine Passive is one that is not explicit in the Bible but was created to explain the available, apparently contradictory, facts. Here are some examples:
- 2 Sam 24:1 vs 1 Chron 21:1 – Who tempted King David to have a census? God or Satan? Both are correct because to the Hebrew mind, God is omniscient and omnipotent and thus events only occur if He allows. James 1:13 explicitly states that God tempts no one.
- Job 2:3 - God says that Satan "incited" God to ruin Job, even though it was Satan that was the direct cause of Job's ruin
- 1 Sam 16:14, 16, 18:10, 19:9 – God sent an evil (literally, unclean) spirit on Saul? God does not have an evil spirit to send! Again, the omnipotent God is deemed responsible for that which He does not prevent.
- Judges 9:23 has an identical idea of an evil spirit from God.
- 1 Kings 2:22, 23, 2 Chron 18:21, 22 all have a “lying spirit” from the LORD.
- Ex 9:12, 10:1, 20, 27, 11:10, 14:8 – God causes Pharaoh to harden his heart??? Clearly not! Compare Ex 8:15, 32, 9:34 where Pharaoh hardens his own heart.
- Compare Rev 17:1 where God judges the great prostitute, with, Rev 17:16, 17 where the great prostitute becomes a victim of her own wicked ways.
- In Eze 14:9 says, “I the LORD have enticed/deceived that prophet”; whereas James 1:13 says that God does not tempt anyone.
- Eze 20 – Judah makes some bad choices and rejects God’s laws and so God gives them other statutes and laws including child sacrifice (V25, 26). In fact, this is what Judah has chosen.
That is, as the omnipotent God, the Hebrews attributed "cause" of everything to God - that is, God is thought to cause that which He does not prevent.
This principle can be readily extrapolated to other many (not all) other passages where the passive voice is used; eg, the beatitudes of Matt 5, Rom 3:28, 1 Cor 7:23, Gal 5:13, Eph 2:5, Matt 9:2, 1 Peter 1:18.
This same idea is expressed another way in some places where God allows sin and evil to reap its own consequences and cause its own downfall.
- Job 5:13 - He catches the wise in their own craftiness, and the schemes of the wily are brought to a quick end.
- Ps 5:10 - Declare them guilty, O God; let them fall by their own devices. Drive them out for their many transgressions, for they have rebelled against You.
- Ps 7:15 - He has dug a hole and hollowed it out; he has fallen into a pit of his own making.
- Ps 9:16 - The LORD is known by the justice He brings; the wicked are ensnared by the work of their hands.
- Ps 37:14, 15 - The wicked have drawn the sword and bent the bow to bring down the poor and needy, to slay those whose ways are upright. But their swords will pierce their own hearts, and their bows will be broken.
- Ps 69:22 - Let their own table before them become a snare; and when they are at peace, let it become a trap.
- Ps 141:10 - Let the wicked fall into their own nets, while I pass by in safety.
- Prov 5:22 - The iniquities of a wicked man entrap him; the cords of his sin entangle him.
- Prov 11:6 - The righteousness of the upright delivers them, but the faithless are trapped by their own desires.
- Prov 12:13 - An evil man is trapped by his rebellious speech, but a righteous man escapes from trouble.
- Prov 28:10 - He who leads the upright along the path of evil will fall into his own pit, but the blameless will inherit what is good.
- Isa 3:11 - Woe to the wicked; disaster is upon them! For they will be repaid with what their hands have done.
- Hos 11:6 – A sword will flash through their cities; it will destroy the bars of their gates and consume them in their own plans.
Thye passage quoted by the OP is a perfect example of this - Pharaoh hardened his own heart and turned to hate the Israelites; but in the Hebrew mind, God was the cause of that which He did not prevent and so in Ps 105, God is said to cause this.