Its not possible that both can happen.
According to Matthew 27:1–10, after learning that Jesus was to be crucified, Judas attempted to return the money he had been paid for his betrayal to the chief priests and committed suicide by hanging. The priests used the money to buy a field to bury strangers in, which was called the "Field of Blood" because it had been bought with blood money. The Book of Acts 1:18 quotes Peter as saying that Judas used the money to buy the field himself and, as he was walking through it, he "[fell] headlong... burst asunder in the midst, and all his bowels gushed out."
Another problem is did he himself buy the field or did he give the money to priests for them to buy it! Only one version can be true !!!
As another posted already said- you're approaching the Bible in a literalistic way, ignoring all literary devices. Matthew wanted to stress prophetic fulfillment when he mentioned that the priests purchased the field. The fact that
the potter's field was purchased is significant because it alludes to the prophet Jeremiah, when God called the prophet to go to a potter's field to hear His words- and he was later instructed to buy such a field.
Why? Because after witnessing
the vessel [the potter] was making of clay [spoil] in [his] hand, he reworked it into another vessel, as it seemed good to the potter to do, God told Jeremiah (I urge you to read it in its entirety- it's all critically important):
O house of Israel, can I not do with you as this potter has done? says the Lord. Behold, like the clay in the potter’s hand, so are you in my hand, O house of Israel. If at any time I declare concerning a nation or a kingdom, that I will pluck up and break down and destroy it, and if that nation, concerning which I have spoken, turns from its evil, I will repent of the evil that I intended to do to it. And if at any time I declare concerning a nation or a kingdom that I will build and plant it, and if it does evil in my sight, not listening to my voice, then I will repent of the good which I had intended to do to it. Now, therefore, say to the men of Judah and the inhabitants of Jerusalem: ‘Thus says the Lord, Behold, I am shaping evil against you and devising a plan against you. Return, every one from his evil way, and amend your ways and your doings. Jeremiah 18:6-11
You see, Israel did
not repent of its sins-
not then, when God first spoke this prophecy,
nor later, when Matthew applied this prophecy also to priests- who represented Israel- who handed Jesus over to be crucified. In Jeremiah 19:1-15, it is described how Jeremiah is instructed to take a pot to
the valley of the son of Hinnom, to a gate, and proclaim to the people His judgement. God tells Jeremiah to say:
"Hear the word of the Lord, O kings of Judah and inhabitants of Jerusalem. Thus says the Lord of hosts, the God of Israel, Behold, I am bringing such evil upon this place that the ears of every one who hears of it will tingle. Because the people have forsaken me, and have profaned this place by burning incense in it to other gods whom neither they nor their fathers nor the kings of Judah have known; and because they have filled this place with the blood of innocents"
Blood of innocents is a curious term, which jumps out at us because of Judas' own words to the chief priests and elders after betraying Jesus,
I have sinned in betraying innocent blood (
Matthew 27:4). He goes on:
"Therefore, behold, days are coming, says the Lord, when this place shall no more be called To′pheth, or the valley of the son of Hinnom, but the valley of Slaughter."
This calls to mind the note Matthew leaves in 27:8, that the location where Judas killed himself became known as
the Field of Blood. Ancient tradition says that this Field of Blood is the very same valley of Hinnom, where Jeremiah made this proclamation. And what was spoken of by Jeremiah was fulfilled, which says:
Men shall bury in To′pheth because there will be no place else to bury. Jeremiah 19:11
As for the 30 shekels, this calls to mind Zechariah 11, when the Lord (the "Good Shepherd") tells the traffickers in the sheep to count out the wages He is owed. They count Him to be worth only 30 shekels, so the Lord rejects it and tells them to toss it to the potter. In the gospel account, the priests and elders don't desire to put the money returned to them (which was rejected by Judas) into the treasury, because it is blood money- so they do precisely what those in Zechariah are told and "throw it to the potter", buying the field. Because of their actions, the wicked shepherds (and Jerusalem) are cursed. And such resulted in the destruction of Jerusalem in 70 A.D.
To sum all of this up, the purpose of these prophecies in Matthew's gospel is to proclaim the judgement that has been declared on Jerusalem for killing the Messiah. Maybe the priests bought the field, maybe Judas did- both Matthew and Luke had a message to convey. Matthew wished to describe Jerusalem's role (and fate) for denying the Messiah, and Luke desired to explain Judas' particular fate.