Mostly for bookkeeping, inventory and fiscal reasons.
They can't simply trade a device, because it will not match their fiscal records when they need to pay taxes, and can cause a lot of issue, if you said you sold a green iPhone, and but your inventory states you are missing a gold one instead.
For Fiscal reasons, they refund the green one, so they can restock it, and then sell you the color you want. This keeps all records correctly set, and does not cause any taxing issues later when their stock does not match their sales.
There should be no issue returning the phone, and getting the color you want. Why can't you do that?
Unless you stole it, and don't want the Apple Store to be asking any questions which could put you on the spot, there should be no problem in simply returning the phone for a full refund, and buying the color you want then.