Although this got moved to the Pit and all, I feel Jamie deserves a GQ type explanation for the cop’s behavior, in order to decide how he should feel about it. Disclaimer: IANA cop, but I know a few. My neighbor (and friend) across the street is a cop, for example.
What the OP describes is a standard technique cops are taught in their training. Ask a mildly rude, intrusive, and somewhat accusatory question. The ‘why’ is the interesting part.
Innocent people will (generally) indignantly, but instantly and truthfully, answer the question in a manner that immediately eliminates the cop’s suspicion. No need for the cop waste his (and your) time to go to the trouble of running your license and such.
Guilty people? Unless they actually invented and rehearsed a story in advance, they will hem and haw trying (and generally failing) to make up a plausible lie on the spur of the moment. Cop knows he has a live one, and it’s no waste of time investigating further. Alternatively (and surprisingly commonly) the perp will blurt out the damning truth, saving the cop the need to waste time investigating further.
While you do have the right to refuse to answer the question, if you do, the cop doesn’t know if he has an innocent standing on his rights on principle, or a guilty one doing the same in the hopes of stonewalling and getting off. He has to run the license to see, with no guarantee he’s not wasting his and your time.
So pretend you’re a cop. You have this frequently productive technique you’ve been trained in, to immediately cut to the chase and separate the innocent from the guilty without wasting your own or the innocent suspect’s time, which just happens to be mildly rude, intrusive, and annoying to the possible perp/innocent, or you can verify everything the time consuming hard way. Which do you choose?
Cop chose the shortcut he was trained for, in this case. Jamie gave him the first response. Fine. You both go your own way, with the minimum wasted time on either of your part, you mildly pissed at the rudeness of the question, him possibly (or not) mildly pissed at not being able to write someone up, but glad he didn’t have to waste much time with you.
Oh, and since it’s the Pit: Fucking fuckers fucking well should fuck off. And the cop was a bastard and the OP is a jerk… [/manufactured outrage I don’t really feel, which includes opinions on cops and OPs I don’t really hold]