According to the Torah, there are two types of shomrim (people who agree to watch something for someone else) – a shomer hinam (someone who does it as a favor and will not be paid) and a shomer sakhar (someone who is paid for his time and effort). The shomer hinam will only pay for the object if he did not watch it properly, but if it is lost or stolen, he will not have to pay, rather he will simply need to take an oath that he watched the object properly. A shomer sakhar has a higher level of responsibility and he will have to pay for the object even if it was lost or stolen.
According to the Mishna (Massekhet Bava Metzia 33b), in the event that a shomer hinam chooses to pay rather than to take an oath that the object was stolen, should the thief be found, then the shomer hinam will receive the double payment, since the owner has already received payment for the object.
Our Gemara discusses a case where the shomer hinam first takes an oath that the object had been stolen and then pays the owner for it as well. In this case, Rava believes that he will still receive kefel (double payment) from the thief when he is found; Abaye rules that kefel should be paid to the owner, who will then pay back the shomer hinam the money he received from him.
The Tosafot Ri”d explains the argument as follows. When the shomer hinam chooses to pay the owner, he is not actually purchasing rights to the object. This is clear, since the thief will have to return the object to the original owner if it is still extant (the owner will then have to return the payment to the shomer hinam). The reason that the shomer hinam receives kefel is a concession made to him because by agreeing to pay, he freed the owner from a protracted court case investigating the circumstances of the disappearance of the object. In our case, even though the shomer hinam eventually agreed to pay, that was only after the court case took place. Thus there is room for Abaye and Rava to disagree about who deserves to receive the kefel.