Oil prices gain, US crude trails Brent after inventory data