I'll give out all my secrets, in public.......
As for Camp 4.... on the July 4th weekend, it will be incredibly crazy.
A) you can in general crash in Camp 4 (but you didn't hear it from me since I won't condone it......), if you just bivi on a site (best to ask the current residence for permission but most people don't mind) if you don't put your bag down until after 8pm and leave before 7-7:30am the following morning. The rangers will be through the camp sites once or twice at night. Don't worry, their primary concern is bear violations (leaving food, trash, etc... laying around). They will occasionally write tickets for illegal camping ( only seen it happen to one person, believe it was Owen Silver; an ex-gunkie....). If you are being loud they will write you up though.
If you want to camp legally in Camp 4, even in the summer its not that hard. On the 4th of July weekend, the first morning, get to the kiosk at the parking lot at Camp 4 at 5am, bring a sleeping bag and pad, and crashout until the kiosk opens (8:45am). You'll generally be the first few people in line if you do this.
For the first night you can either crash illegally or, there is legal BLM land just outside of the Hwy 120 gate. Almost exactly 2miles before the park boundry on Hwy 120 there will be a road sign saying "4000ft" on the left side of the road, it will be the 2nd or 3rd such sign you will see driving from Big Oak Flats on Hwy 120. At the sign on the left side of the road, there will be a little turn off on the left side of the road (going East). If you look closely there is a paved road which continues 50-100ft and turns into a dirt "road". Take the "road" until a fork in the road, and go left. You'll pass a set of beehive boxes (or whatever they are called). Continue down the road (watch the ruts, they can be deep), until a turnaround. There is a lot of camping around that area, and you will usually see between no one and 1 or 2 other groups.
On the fourth of July the "Valley" will be hot. You'll be better off going to either Tuolumne (I can tell you several free sites just outside of the park boundries) in Tuolumne if you need. I also highly suggest Calavaras Dome to the north by about 60miles (Yosemite-quality climbing with NO ONE around and gorgous riverside camping (which is free). The climbing is Yosemite-quality with routes such as the Wall of the Worlds (probably the best 5.10c cracks I've seen-if you combine the first two pitches), Silk Road ( a good 5.11 corner) or Gemini Cracks (THE BEST 5.9 I've seen EVER). .