If you enter the park very late at night, drive through, and exit before dawn, the entrance and exit stations will likely be unstaffed, so your cost is zero. On the other hand, I've seen them stay open until unusual hours once in a while, just to keep visitors from planning on this action. The station least likely to be staffed is Tioga Pass.
For a period once some years ago, they had a special deal. If you were driving straight through the park, they would collect $20 from you at the entrance and give you a time-stamped receipt. If you hit the exit in two hours or less, you could request and they would refund $15 of the $20. That was a good deal. However, some visitors would pay the $20 at one end, drive through, and then the exit station was unstaffed, so they could not get the $15 refund. Lots of taxpayer complaint letters got written about that.
If you are driving straight through, it is best not to exceed the posted speed limit by much. Speeding tickets are very high (it is a federal rap). Plus, at night there will be some wildlife out on the road, and car damage from a deer impact will cost you a lot more than that.
If you are in and out of the national parks a lot, it might be economical to get a pass. Then get each of your riders to chip in some bucks toward the pass cost.