PALO ALTO, Calif. — London, Singapore, Stockholm and a few other cities around the world battle heavy traffic with a “congestion charge,” a stiff fee for driving in crowded areas at peak hours. But drivers generally hate the idea, and efforts to impose it in this country have failed.

Balaji Prabhakar, a professor of computer science at Stanford University, thinks he has a better way.

A few years ago, trapped in an unending traffic jam in Bangalore, India, he reflected that there was more than one way to get drivers to change their behavior. Congestion charges are sticks; why not try a carrot?

So this spring, with a $3 million research grant from the federal Department of Transportation, Stanford deployed a new system designed by Dr. Prabhakar’s group. Called Capri, for Congestion and Parking Relief Incentives, it allows people driving to the notoriously traffic-clogged campus to enter a daily lottery, with a chance to win up to an extra $50 in their paycheck, just by shifting their commute to off-peak times.