Their diagnostics machine should be able to detect why/where the issue is coming from, that's causing the light to go on & give a cause code. It almost sounds like they're doing bogus repairs so they can collect payment for them.
I wouldn't buy a new car because of a check engine light going on. Lots of times the cause is minor. I would get a second opinion elsewhere - either at another dealership or pay out of pocket for your own. You can take it to a Checker (or similar) auto store & they can check codes. Even if you pay out of pocket at an independent auto repair facility, it's still better than the alternative.