This has been brought up a couple of times in Odo's conversations, but in short, he's using Quark to weed out the worst criminals. On a station that large, with so many coming and going, it's impossible to get them all.
This is a point of contention between Odo and Worf in 4x04, Hippocratic Oath. Worf is used to starships, where security is tight and there's next to no crime, while Odo understands that you can't stop all crime in a station as open as Deep Space Nine. He only goes for the big fish:
(Quark passes a container to a smuggler. Worf walks in with his phaser drawn and takes the container)
Worf: Trafficking in illegal merchandise is a felony under Federation law.
(Quark leans down to talk to the case)
Quark: What's he doing here?
(The case - actually Odo - shifts back to his normal form)
Odo: A very good question.
Worf: I was just about to arrest these criminals.
Odo: I should arrest your for interfering in my investigation.
Smuggler: Will someone tell me what is going on here?
Worf: Odo. Why did you not tell me what you were doing?
Odo: I don't report to you, Commander. And I don't spread the word when I'm conducting an undercover investigation. I also thought that your surveillance would make the setup more convincing. I'm not interested in this man. He was supposed to complete the transaction and take the latinum back to his ship, so that I could infiltrate the entire Markalian smuggling operation. Now I suppose I'll have to settle for the middle-man.
This was unusual in that Quark was in on it, but the same basic idea is how Odo handles security in general. Later, this is what Sisko has to say to Worf on the topic:
Sisko: Starfleet officers often have trouble learning the unofficial rules of the station. There's no manual to study. You have to learn things as you go. A little different than life on a starship.
Worf: When I served aboard the Enterprise, I always knew who were my allies, and who were my enemies.
Sisko Let's just say, DS9 has more shades of grey. And Quark definitely is a shade of grey. He has his own set of rules, and he follows them diligently. Once you understand them, you understand Quark. I'd say that's true for everyone here.
For Odo, this means casting his net wide in order to catch the worst of the criminals - even if it means working with (or manipulating) ones like Quark who rarely actually commit crimes, but simply enable others.
For Quark, well, he's a Ferengi. His goal is profit. If something falls through due to Odo, he has an excuse not to deliver, and if not - well, it's likely Odo knew about it anyway and let it happen for reasons that don't concern him. As long as he doesn't make his dealings out in the open - dealings which would be obviously illegal - he knows Odo is unlikely to arrest him.
(That said, I think he's ended up in a holding cell a couple of times)