If you are going to have someone do work for you it's probably best to ensure they have your best interests at heart. "One who says to his friend go a betroth a woman and he goes and betroths her to himself, she is married to the second one" (Kiddushin 58b). While the agent may have lost a friend he does gain a wife [1].
  
Yet what is legal is not necessarily moral. "What he did was done but he practiced the practices of a ramai, a cheater." Sadly cheaters often can get ahead; honesty is a moral virtue not always a practical one. 
 
Yet it is not always clear how to define a ramai. The Gemara relates how Ravin Chisda went to betroth a wife for his son but decided to marry her himself. As to how he could do such a thing the Gemara explains that the girl was not interested in marrying the son but was happy to marry the father[2]! Yet that does not satisfy the Gemara which expects that the father has an obligation to at least notify - and presumably get approval - from the son. To this the Gemara responds that Ravin Chisda was afraid that with the time it took to go and tell his son and come back someone else may have betrothed, been mekadesh, the women[3]
 
The Gemara follows up with a similar story from the world of commerce where Rava bar bar Channa gave money to Rav to purchase a field on his behalf. Yet Rav went and instead purchased the field for himself. When asked how he could do so the response was that the land was situated in a neighborhoud of "strong people" who were not willing to let all move into the area. "Rav they honored [to let him buy] but Rava bar bar Channa they did not honour." As to why Rav did not go back and consult with Rava bar bar Channa here too the answer is given that he was afraid in the interim someone else would buy it.
 
The Talmud ends this sugya with a third story, where the greatest efforts are taken to avoid any appearance of impropriety.  
 
Rav Gidal was examining a piece a property with the intent of purchasing it. In the interim Rav Abba purchased the piece of land something that did not please Rav Gidal, who went to complain to Rav Zeira. When Rav Abba was came to Jerusalem they asked him his thoughts regarding "a poor person who is examining a piece a cake and another comes and takes it." As the poor person has not yet sealed the deal technically the interloper has done nothing wrong. He is it could be argued acting like a sharp businessman moving quickly before another gets the deal first. Rav Abba answered such a person should "be called evil[4]", to which Rav Yitzchak asked him why he himself had done such. Rav Abba responded that he had no idea that Rav Gidal was negotiating to buy the field. Rav Yitzchak then instructed Rav Abba to let Rav Gidal purchase the property. However as this was the first piece of property Rav Abba had bought he did not want to sell the land to Rav Gidal - "it is not a good omen" to sell one's first purchase - but instead offered to give the land to Rav Gidal as a gift. Rav Gidal quoting the advice of King Solomon that "one who hates gifts will live" refused to accept the gift. "Not this one would use it and not this one would use it and it was called the land of the Rabbis" (Kiddushin 59a) becoming community property available for all to use. The refusal of each party to possibly encroach on the rights of the other was a net gain for the community at large. 
 
Those whose main concern is the bottom line might find this story almost absurd. One can look for and find justification for all kinds of practices. And at times that may be legitimate. But more often than not there are other more important considerations to keep in mind. Snatching away someone else's anticipated gain - even inadvertently - [5] earns one the label of rasha, evil, even if and perhaps because, there is no legal recourse to be had.  
 
[1] The Gemara actually notes that the Mishna specifically uses the term "chaveiro, friend" and not, as it does elsewhere, shelucho, his agent. While one would expect more from a friend than from a legal functionary, the Gemara notes that it is the agent hired to do a job who has greater responsibility in carrying out the wishes of the sender. 
 
[2] The Gemara does not specify the age of the parties involved and admittedly it seems a little unusual to say the least, that the same person would be appropriate for both a father and a son. Perhaps the girl was attracted to Ravin Chisda's great scholarship and was happy to marry someone much older. Such is how the Netziv, the great Rosh Yeshiva of the Volozhin Yeshiva married his niece - 36 years his junior after his first wife died. It was she who wanted the honour to marry this great scholar. The Netziv was 74 when their son Meir was born. Like his father he greatly supported, and was heavily involved in the Zionist movement. He Hebracized his name from Berlin to Bar-Ilan and it is in his honour that Bar-Ilan University was named. His half-brother 55 years his senior is memorialized in the naming of Yeshivat Chaim Berlin.
 
[3] While this is most strange to us this concern has legal ramifications in a most positive sense. One is allowed to betroth a woman on Tisha B'Av lest if one wait it be too late! (Tosafot Yevamot 43b s.v. shani)
 
[4] The Gemara introduces us to both a ramai, a cheat and a rasha,an evil person. The Gemara does not tell us which one is the worse of the two. Evil can be dealt with, but those who pretend to be trustworthy but are far from it, pose I would argue, a greater threat to society. While Pharaoh was wicked Lavan was a cheat and as we read on Pesach it is Lavan who "tried to uproot everything."
 
[5] It is important to note that Rav Moshe Feinstein rules (Chosen Mishpat #1:60) that even if the interloper was unaware that another was "examining a piece of cake" i.e. had entered into negotiations towards completing a deal, he would still be labeled a rasha and is obligated to withdraw and let the original party complete the deal.