In many (most?) cases you can. But you may need a permit to enter some areas, which may or may not require a fee (if it does require a fee, it's usually pretty small). For instance https://www.nps.gov/yose/planyourvisit/wpres.htm
Usually these fees are for multiple days. For Yosemite: car fee is valid for a week(there are other deals if you want to stay for longer or visit multiple times an year). The wilderness permit... I don't really know. You do have to submit start and end dates for each trip, but the fee covers the duration.
It’s $5 for a group wilderness permit application plus $5 per person per permit. I think it’s another $5/person if you want to add on the Half Dome summit.
Usually these fees are for multiple days. For Yosemite: car fee is valid for a week(there are other deals if you want to stay for longer or visit multiple times an year). The wilderness permit... I don't really know. You do have to submit start and end dates for each trip, but the fee covers the duration.
EDIT:
Also Yosemite: it appears that foot traffic is charged too. https://www.nps.gov/yose/planyourvisit/fees.htm
That highly depends on the park.