When I wanted to hike Half Dome, it was too late to apply to the lottery you mentioned. Therefore, upon arriving in California in September, I tried to get a last minute "daily" permit through the Park Service's web site.
When I got this permit, it was for the next day, and of course I didn't have a camp site. I drove to Yosemite with my wife, and within the campsites, we looked for a campsite with only one car (each campsite is allowed to have up to two cars). We asked the people there if we could join them. The third couple that we asked agreed, and we ended up staying at their campsite both the night before and then night after our hike.
I think in most cases, this will work out. Obviously, there is a certain element of risk, but the closest camp site or lodging we could get on a single day's notice was so far away that it seemed like practically the only choice for us, given the constraints we had, and it might work for you, too.