There are three pieces of land, each of which is being sold for 20,000 riyals, or all three for 45,000 riyals. Is it permissible for me to buy all three pieces of land if I know that there are two people who will buy two of the pieces of land for 20,000 riyals each, and I will keep the third, and I know these two buyers?.
It is permissible for you to buy these pieces of land for 45,000 riyals then sell two of them for 40,000 and keep the third piece for yourself.
‘Urwah ibn al-Ja’d (may Allaah be pleased with him) bought two sheep for a dinar, then he sold one of them for a dinar, then he went back to the Prophet (peace and blessings of Allaah be upon him) with one dinar and one sheep, and the Prophet (peace and blessings of Allaah be upon him) prayed for blessing for him. Narrated by al-Bukhaari (3643).
What matters is that your purchase of the land be a permissible purchase, with no wrongdoing or transgression against anyone.
Do not sell any of them until you have taken full possession of them, because of the report narrated by Abu Dawood (3503), al-Tirmidhi (1232) and al-Nasaa’i (4613) from Hakeem ibn Hizaam (may Allaah be pleased with him) who said: I asked the Prophet (peace and blessings of Allaah be upon him): O Messenger of Allaah, a man comes to me and asks me to sell him something that I do not have to sell to him, but I go to the marketplace and buy it for him. He said: “Do not sell what you do not have.” Classed as saheeh by al-Albaani in Saheeh al-Nasaa’i.
It is not permissible for you to sell the land to these two men before you have bought it, so buy it first, then sell it to them if you wish.
And Allaah knows best.