The "trick" I've seen is just doing it with enough space to be safe and with property owner permission. The cops are likely caring about safety not the letter of culturally unenforceable law on July 4th. Problem is this don't work in the suburbs and cities, it's just to dense.
We are very much in the suburbs. It can get crazy.
If you have a cop or two at the party, and, often, a volly firefighter running the sparks, it seems to be OK.
A few years ago, one of our neighbors was running one, and a mortar fired into his second story. It was a 5-alarm fire.