You can do this two ways. First, you can scan your items at home and make a list by lowest price for each store, or, if you're already at the store and contemplating a purchase, you can scan it to see if you're getting the best deal. Then, you have an equation on your hands: I save X dollars if I drive Y miles, and it will take Z time. Maybe for one product, it wouldn't make sense, but if you have half of a grocery list that's cheaper at the other store, then it might make sense.
This app also contains consumer reviews of the products you're scanning, so you can see if they're even worth the hassle.
I've used this app for everything from DVD's to car wax to coffee to frozen vegetables. I believe that one could pay for the extra cost of having a Smartphone with this one app.
If you're interested in this app, but don't have a smart phone, THIS is a good place to compare prices.