If you're lucky these are sometimes hand written inside the owners manual or on a a business card that says "radio code" on it that's placed inside the document holder that was supplied with the vehicle.
People are also known to write it on the top/bottom of the actual radio itself. This would require removing the radio.
Dealerships can usually access this information by the VIN number. If not then they'll pull the radio for you and use the Serial Number on the Radio.
If it's simply just the dealership looking it up via the VIN number then there should be no charge and can usually be done over the phone. If it requires pulling the radio, then I would imagine it's a flat fee which is somewhere around a half an hour labor. ~30-40 dollars is an average of what I see in Los Angeles.