You had what is known as Carb Puke. Turn the gas off next time, about 15 seconds before turning the switch off, when you stop. Don't forget to turn it back on.
Had the same thing happened to me a couple of weekends ago in Sonora. It's the first time it's happened to me since I vented the gas cap. Kind of messy and frustrating but it's not that big of a deal. And as far as getting pulled over by the CHP on highway 140, yeah, that's a real tough spot for cops. Especially in Cathey's Valley. I've been pulled over more than once there for sure. They must be able to fund their entire year's budget just off of tourists going to Yosemite, lol!