Seems like issue is prev. owners losing the code
It's kind of amazing how often this happens. You buy a used vehicle. It's missing key codes, radio codes, and comes with only one key, which may not be an original. The owner's manual may also be missing. Why can't people keep track this stuff? (As far as owner's manuals, some end up on ebay.) I imagine there are occasions when people trade in their car on the spur of the moment and all the bits and pieces at home don't go with the car.
I think it's probably correct that the security added by having radio codes is minimal. It's possible to call some dealers and get the code without proving you own the radio/car. That is, of course, very convenient if you can get a code by phone, and I had to do it after buying my car also.
The "dealer gave me the wrong code" issue is also extremely common. (Happened to me also, and I had to contact a 2nd dealer to get the real code). It seems that BMWs code retrieval computer system is too complex for the dealers. My local dealer INSISTED that there is only one code available (Alpine) from their computer system and if it didn't work, my only option at that point was to replace the "defective" radio. ("Sir, the code we provided was correct, and I don't care what you read on the internet, there are not multiple codes available").
If it weren't through forums like this, replacing the radio might have been what I ended up doing. So the numerous posts on the matter are of value. Plus, once you get the right code, and find a way to not lose it, the whole matter ceases to be a problem.