How does this work, exactly?
Basically it works like this : You reset the Pokemon until you get a good IV spread + nature (usually agreed on in advance).
What you get out of it depends on the deal. For example, I have traded a Pokemon for a code. This means that the person who originally had the code gives it to me, and I can do what I want with it. They only get the Pokemon I traded to them.
Or, you can make a deal where you essentially get the code for "free", but then you share the resulting product with the person who gave you the code, so you both have semi-redis rights to the resulting product. So one person gets the code, one person does the resetting, and both profit :)
EDIT : Usually the reason for doing this is either 1) Person who gets the code doesn't have time to reset it, or 2) Person who gets the code has a system that doesn't match the region of the code, or 3) They have more than 1 code