Yes it is ilegal in most states with seperate sewer systems. You cant have storm water going into a sanitary system sewer line. But if you have a comb. storm& Sanitary sewer then it should be okay. Check with your Plumbing inspecter.
By “inspection pipe” I assume you mean the cleanout riser that ascends vertically from a Kelly fitting installed in the building sewer. You can certainly tie into this pipe with a proper fitting (e.g. a combo) buried at an appropriate depth/slope to drain any plumbing fixture supplied by muncipal or well water. For reasons that RP mentioned, you shouldn’t drain landscape runoff (storm water, springs, etc.) into the municipal sewer system. You might be permitted by code to do so in your own septic system, but that would be foolish.