The reason for Quark's presence is actually given in the pilot. Basically Quark is all ready to pack his things and go, reckoning the place has got a bit unstable - no good for profit! - and he's probably not going to be too popular with the new people in charge, seeing as he ran the establishment under the Cardassians.
It's Sisko who basically blackmails him into staying because he needs someone to show everybody that the station is worth remaining on. If the last shop closes, that sends the message that there really isn't a point.
The station is a total wreck when the Federation take it over since the Cardassians destroyed everything they could on departure (a little gesture of welcome), and people were leaving it like rats off a sinking ship. What better way to persuade them there's better days ahead than someone like Quark going, "well, you still might not have a proper mattress to sleep on, but come by and have a drink, and another drink, and there's fun to be had...!"
As for some of his shady activities being tolerated to an extent, Quark is usually sailing close to the wind in that he's hovering round the edges of outright crime as a third-man facilitator, and with Odo keeping such a hawk's eye on him, Quark is useful in leading security to some of the much bigger fish that are his associates. Quark's small fry, they can let him skim a bit here and there.
P.S. if holosuites had been invented, I wouldn't be out of there for HOURS on end! (grin)