This guy crashed his bike into a taxi for you
Casey Neistat moved out of the bike lane to avoid an obstruction — like a deliberately parked cop car? MAYBE — and got busted for not riding in the lane. But he's a good citizen; he paid his $50 debt to society and resolved to never, ever deviate from the bike lane again. Here is the result.
Incidentally, yes, it's legal to deviate from the bike lane for safety, including to avoid things that are in your way. It is NOT legal to park in a bike lane. But "laws" are for people who aren't in the NYPD.