OS X license on used Mac? I just got off a very long and very frustrating phone call with Apple support.

I purchased a used Apple computer which came installed with Mountain Lion. Meaning that the computer was shipped by Apple with Mountain Lion installed, and received by me with that same installation.

As a precaution, I tried to reinstall Mountain Lion via Recovery mode. This failed because my Apple ID hasn't purchased Mountain Lion.

Apple insisted that because I didn't purchase the computer new, I don't have a license for OS X. I don't believe this is correct, or even legal. This means that anyone using a used computer is doing so illegally, unless they've purchased a separate OS license.

Am I way off-base here? I'm pretty sure I now "own" a copy of Mountain Lion, and Apple is in the wrong. If this is correct, what are my options?
The agent should get low feedback. The license to Mountain Lion transfers with the computer when it is sold. 

The agent should have told you that no Apple ID is needed to download another copy of the installer since the system prompts you to send the serial number for verification. 

Now, you don't get a license to the Mountan Lion upgrade to install on other computers. That is software you purchase separately from a computer and that is tied to one Apple ID and is not transferable. (like everything else sold from the App Store) 

The one case where you don't get Mountain Lion is if the machine shipped from the factory with Lion but was sold with a "free upgrade" to Mountain Lion. This could happen in the window between when they announce the new OS to when it's released or on Mac that are imaged in the factory before Mountain Lion was released, but sold after the release. 

In that case, Apple have a free redemption of the upgrade to the first Apple ID to redeem it. The only license that would transfer would be Lion and not Mountain Lion.