Legality? It was completely inside our own house, we told nobody . . . no problem.
![Wink ;-)](./images/smilies/icon_wink.gif)
Today, I'd be more concerned about lead contamination, so I'd separate it from the rest of the basement.
If I were building, my new house would have at least a 50' shooting range . . . even if I didn't call it that on the plans. I'd just add a wall alongside the longest side, with a vault door at each end, making the width 6 or 8 feet. Spancrete ceiling, covered with acoustic tile or other sound muffler. (Same for walls and floor.) Probably call it a "Tornado Shelter" and see if I could get a tax credit.
Build or buy a bullet trap (just google "bullet trap") and set it up at one end. Couple the space to the HVAC but put a damper in the line and a good filter over the return, but with a separate ventilation system to use when you're actually shooting to exhaust the sooty air outside, rather than draw it back into the home. Add lighting, a shooting bench, chronograph stand, and you're in business.