I'm not so sure how this works.
The Rays paid $5mill to Seattle at the time of the original non-Yankee deal Whether that money went to the buyout of Encarnacion is immaterial; it's already changed hands, right? After all, if Encarnacion's option was exercised and the Yankees kept him, the Rays would not get the money back, right?
My understanding is, when cash is included in a deal, we as fans say Team A is paying th salary of the player. But in reality, the money is fungible and the cash is simply transferred. For example, if Encarnacion decided to retire mid-season for whateer reason, it's not like anyone gets a pro-rated amount of cash back...