How does Littlefinger get away with buying and selling prostitutes in the show?
He doesn't because he doesn't buy or sell them, he runs the brothels where the prostitutes work and get's a commission from them (probably a large amount). Let's look at what I believe you're referring to in your two examples.
The scene at the tourney joust goes like this.
Petyr Baelish: 100 gold dragons on the Mountain.
Renly Baratheon: I'll take that bet.
Petyr Baelish: Now what will I buy with 100 gold dragons? A dozen barrels of Dornish wine? Or a girl from the pleasure houses of Lys?1
Renly Baratheon: Or you could even buy a friend.2
Renly Baratheon: Such a shame, Littlefinger. It would have been so nice for you to have a friend.
Petyr Baelish: And tell me, Lord Renly, when will you be having your friend?3
Game of Thrones, Season 1 Episode 5, "The Wolf and the Lion"
I've marked the parts that could potentially refer to buying prostitutes and I'll explain why that isn't the case.
- Here Petyr is talking about using a prostitutes services for a given time, he does not mean buying one for keeps.
- Here Renly is saying Littlefinger has no friends and he could buy one, it isn't referring to prostitutes at all.
- Here Petyr is referring to the relationship between Renly and Ser Loras.
In the second example of Ros crying Petyr is likely talking about buying the contract for the girl or just hiring her into his brothel. If he is indeed on about straight slavery, well, there's only him and Ros in the room so no one can hear anyway. He says the following.
Petyr Baelish: You know, you remind me of another girl, a lovely thing I once acquired from a Lysene pleasure house.1 Beautiful, like yourself, and intelligent, like yourself. But she wasn't happy. She cried often. I asked her why, but we didn't have the kind of rapport that you and I have. Yes, it was quite sad. Girls from the Lysene pleasure houses are expensive, extremely expensive.2 And this one wasn't making me any money. I hate bad investments.3 Really, I do. They haunt me. I had no idea how to make her happy, no idea how to mitigate my losses. A very wealthy patron, he offered me a tremendous amount of money4 to let him transform this lovely, sad girl. To use her in ways that would never occur to most men. But you know what occurs to most men. I would not say he succeeded in making her happy, but my losses were definitely mitigated.5
Game of Thrones, Season 2 Episode 2, "The Night Lands"
When you take 1, 3 and 5 together in context with each other he's clearly talking about the investment with the girl and not necessarily purchasing her. He could have hired her from the Lysene pleasure house on a semi-permanent basis for all we know.
Number 2 is referring to that even renting whores from Lys is expensive, likely they are "good quality", and this makes more sense when you take it in context of the first quote from Petyr to Renly.
Lastly, 4 is referring to the wealthy patron hiring the prostitute from Petyr to perform certain services for him.
Note here though that Petyr is using the story to threaten Ros to do what he wants her to do, make him money, as such the story is not necessarily true. It's also worth pointing out that slavery is not abolished in Lys and so those in Westeros need not know where Petyr had got the girl from.
"Slaves," he said. "My holds are full to bursting with ivory, ambergris, zorse hides, and other fine goods. I would trade them here for slaves, to sell in Lys and Volantis."
A Storm of Swords, Daenerys VI