The reason God is not guilty of lying is because you need to think in terms of legal rights.
When you lie you open yourself up to an unclean lying spirit. If you do not repent that unclean spirit has opportunity over you. Legally.
Take another example, anger.
“Be angry and do not sin; do not let the sun go down on your anger, and give no opportunity to the devil.”
Ephesians 4:26-27 ESV
The idea, though there are other longer passages that illustrate this point better, is that if you get angry and sin, you give an opportunity to the devil. What opportunity? The opportunity to legally harass you.
In the council of the Lord that Macaiah saw in the spirit, God was on the throne (think in the capacity as judge, even if as a king making judgment but still a judge) and in the council one says one thing and another says something else.
When the lying spirit spoke up and described his strategy, if Ahab and the prophets were not idolaters, liars and murders, this spirit would have no say in the matter.
But because the spirit was legally representing liars (namely the false lying prophets) the spirit offered to inspire these prophets with more lies. God could not reject his proposition just because it was a lying spirit, in fact because the spirit had legal rights in the hearts of the lying prophets it was entitled to exercise dominion in their lives.
Essentially the spirit was asking permission to inspire through the false prophets more lies
If God would have denied the lying spirit the right then there would have been injustice, especially since it would achieve the end God had in mind, namely, Ahab’s death.
God would have been usurping the freedom (freewill) of the false prophets. And since there was no one else to interject on the false prophets’ behalf the spirit was without challenge. Permission was granted.
God did not lie, it was the false prophets that lived a life of lies that brought this upon themselves and gave an opportunity to the unclean spirit to inspire them to lie some more.
If they wanted to be free all they had to do was confess their lying sins, bring a sacrifice and be free from their legal bondage to a lying spirit.
Today we have the Blood of Jesus that intercedes on our behalf but not if we give opportunity to the devil and sin without repenting.
Consider that in Job the same scenario is played out. The council of God and the elohim are all gathered together. The accuser (prosecutor if you want a legal term) accused Job. He didn’t have a great argument but God had an end in mind and since it could be achieved through this route God gave the accuser legal rights with limits. Twice.
The reason Job was allowed to be in the hands of the accuser was because he unknowingly was ascribing God’s righteousness to himself and that is pride. God resists the proud or the sin of pride. When Job repented and acknowledged his sin, gave credit back to God the accuser had nothing more to accuse Job of.
It’s for this reason that a lot of legal terms are used in the NT. The Holy Spirit is a Paraclete (lawyer) there is interceding on our behalf (making/arguing a case), God is a judge, just to name a few.