I mostly camped legally when i was traveling, but it's definitely tempting to set up camp "off piste" in a national park, state park or other public land where no-permit camping is technically not allowed. The reasoning for this is that if everyone passing through pitched their tent on that land then it wouldn't continue to be a nature preserve, it would just become a campsite, and that hurts both the ecosystem and the visitors who come to enjoy it. On the other hand, as a solo camper it's much more appealing to be surrounded by preserved nature than 37 other douchebags in tents playing music and cracking beers, so the temptation is strong.
One thing you can do to relieve the stress of camping illegally is looking into if there are free backcountry camping permits available. Notably in certain parts of Florida there is, with 24 hours notice. Bit annoying if you're cycle touring and you don't know where you'll end up 24 hours from now, but if you're traveling on foot should be fine. In other parts of the US there are also places where you can camp for free during hunting season, as long as you don't mind hearing gunshots at the crack of dawn and running into drunk Rambo cosplayers. Public fishing lakes are also places where they don't expect you to overnight but it's usually not illegal either. Just keep it low key.
Or you just set up and either hope no ranger comes by, or if they do come by you can sweet-talk them into letting you stay. Or you find the ranger in the first place and give them a sob story about not having anywhere to camp and you'll be gone tomorrow and they'll usually point you out a spot. Of these three the least stressful in my experience is just being up-front about it. If you're legit traveling solo and without an internal combustion vehicle through parts of America that are far away from a grocery store, people do understand that you're out an a limb anyway, and they tend to not be such gigantic assholes that they'll saw it off just for bureaucratic reasons. Especially public servants whose job description is literally to serve the public.
Usual rules apply when dealing with authorities, of course. Be respectful, be humble and apologize if you're technically in the wrong. For me i'd rather get the groveling out of the way before i set up camp than potentially get woken up in the middle of the night and have to do it then, or try break camp before sunrise, or some damn guerilla shit. But that's my calculus which takes into account my own anxiety issues. Lots of stealth campers don't give a shit and just do it anyway. The odds are probably in your favor that if you picked a remote enough spot and only spent 8 hours there, more nights than not you won't have a problem, especially if it's off-season.