When I renewed my H1B visa (I think after three years), I had to leave the US to do it. I couldn't renew it from inside. The permission to work got renewed just fine - I could just keep on working for another three years - but if I left after the first visa expired, and wanted to come back, I would need a new _visa_ (thing stuck into my passport) to come back, and I could only apply for that while outside the country…
In general the law applies equally to everyone associated with the US in any respect so you get due process (in theory) regardless. Specific laws may apply to different classes of people though (see 'enemy combatants').