Ahab was the most wicked king who had reigned over Israel yet (1 Kin 17:30-33); his wife was a Phoenician princess, a thorough Canaanite, who instituted Baal worship all throughout Israel and persecuted the prophets of the LORD (1 Kin 18:4). The priests and prophets who were in the land of Israel, were not priests and prophets of the LORD God.
Now previously Jehoshaphat had fortified himself against Israel in the case of war between them (2 Chr 17:1). But in order to prevent war and to establish peace between the kingdom of Judah and the kingdom of Israel, Jehoshaphat arranged for his son and heir to be married to a daughter of Ahab, and in this way he allied himself with Ahab by marriage. Because they were now allies, he made a diplomatic visit to Ahab in Samaria. But it was not from the LORD that he did this, because the LORD’s prophet reproved him for helping the wicked and loving those who hate the LORD (2 Chr 19:2).
The 400 prophets who prophesied success for Ahab in going up to recover Ramoth Gilead, were 400 prophets of Asherah (a Canaanite goddess) and not prophets of YHVH. The prophets of Baal had been killed by Elijah at Mount Carmel, and only the prophets of Asherah remained (1 Kin 18:19, 40). The prophets of YHVH had been persecuted until Elijah thought he was the only one who had survived the purge (1 Kin 19:10).
This is why when the 400 prophets began prophesying success for Ahab, Jehoshaphat asked, Is there not a prophet of the LORD that we may inquire of?, and Ahab answered that there was still one who remained (2 Chr 18:6-7). Apparently the false prophets believed that as prophets, they could prophesy of the spirit of any god they called upon, including YHVH (2 Chr 18:10, 23).
As far as the lying spirit sent from the LORD, we already know that the nature of the enemy’s kingdom remained veiled until the advent of Jesus, who defeated all his kingdom. Suffice it to say, that the lying spirit could not transgress the boundaries set for it by the LORD, which He set for His own purpose. The true prophet prophesied truth by the Spirit of the LORD, while the false prophet prophesied lies by a spirit from the LORD (2 Chr 18:23).