Atmospheric pressure isn't constant. It's always changing. A change of 1" or Hg (mercury) will equal 1000 feet of elevation. So even on a short ride, it's reasonable that the barometer might have changed a few tenths of an inch, so 200, 300, 400 feet of difference will be in the ballpark.
Elevation gain is just a gee-whiz number, don't get caught up in it. If you want to climb good, then climb a lot.