Also I got the impression that even if they checked you at the gate and you didn't account for something in your car or on you and they found something you shouldn't have, they could deny you entry right there and you weren't getting back in anytime soon. Someone panicking and driving away might set off some dude's suspicions and you weren't going to fix things... and it took a while to schedule everything.
It was as much about protocol and just making good choices / customer service (don't scare your customer) as anything else.
Usually there's a large sign "Foo Air Force Base" (or whatever) by the civilian road, then you turn off and drive on a military road for half a mile or more (sometimes much more), then you come to the gate with the guards.
But you've still been on military land, and subject to military rules and laws, from the instant you enter their property.
Edit: just checked. The guardhouses for two of the gates at a local facility are respectively about 800/1,000 feet away from the public road, and about 600/800 feet inside the perimeter fence (the one with signs reading "patrolled by dogs", "deadly force authorized", etc.).
If the government wants to do something legally beyond that, they probabbly would feel it is worth it to discourage such behavior.