NEW YORK — New York City is running afoul of its own rules by slapping delivery workers with hefty fines for riding illegal electric bicycles, a new lawsuit argues.

The Legal Aid Society sued the Office of Administrative Trials and Hearings and the NYPD on Monday in state Supreme Court in an effort to get rid of a $500 fine that a deliveryman for a Chelsea restaurant got in November. While Mayor Bill de Blasio has said his e-bike crackdown would target businesses rather than workers themselves, OATH's commissioner recently ruled that cops can decide whether to ticket the cyclist or their employer. That decision doesn't jive with the city's administrative code or the NYPD patrol guide, both of which put the burden on the business, the suit argues.

"This lawsuit is designed to ensure that OATH complies with existing law so that our clients and other low-income food delivery workers are no longer illegally ticketed while trying to earn a living," Steven Wasserman, the Legal Aid lawyer handling the case, said in a statement. OATH hearing officers have previously tossed out tickets given to delivery workers using throttle-powered e-bikes on the grounds that their employers should have received them instead. While such bikes are illegal, the city code says businesses — not individuals — should be liable for penalties when one of their employees is caught riding one on the job.

A hearing officer handed down a similar ruling in the Chelsea deliveryman's case, the lawsuit says. But the OATH commissioner reversed it on appeal from the NYPD, finding that the Police Department had "discretion" to ticket the cyclist instead of his employer, according to the complaint. Legal Aid's lawsuit argues that's a misreading of the city code, which "squarely places 'liability for penalties' on business owners." It also runs counter to the NYPD's patrol guide, which directs cops to issue tickets to businesses personally or by mail if they find a cyclist is riding an illegal e-bike for work, according to the complaint.

The cop in the Chelsea deliveryman's case didn't try to determine whether he was on the job, according to the complaint. While the worker got his summons three days before the patrol guidance was published, OATH still should have considered its contents, the suit argues.

"NYPD regulations do not give patrol officers a choice of whom to serve for business-related E-Bike violations," the complaint reads. "It directs officers to serve business-related violations ... upon the business — not the bicyclist."