It is illegal but I think it was more an attempt to extort money from me.
However, I was in a very bad mood at the time so I hopped on the back of the cop's moped and said "fine, take me in. I don't care any more. I'll pay the fine." and he & his partner let me go in return for a couple of 50 cent cups of coffee at a kiosk.
They also gave me their phone number in case I wanted to go party with them later that night
great Monday morning laugh! So did you go party with them ;-)