There is undoubtedly an element of profiteering here, but there's also a basic rational economic reason.
Say you're a gas station owner. You filled your tanks last week at a given price, and have been selling your gas at retail for $2.10 per gallon. This week, you know that a hurricane is disrupting production in the Gulf, and your supplier has warned you that your next tanker full of gas will be (say) 10% more expensive due to difficulties with refinery supply. You therefore have to have the money on hand to pay for that gas, and so you increase your retail price to $2.30 a gallon. The extra money isn't so much excess profit on the tanker of gas you got last week, as it is providing for the much-more-expensive tanker of gas you'll be getting later this week.
Of course, things don't work the other way around. If you're selling gas at $2.30 now, and you're informed that your next tanker load of gas will be 10% cheaper, you can't reduce your current price, because that's covering the cost of the gas you got last week. You can (and usually market forces will ensure that you do) reduce your price on the new tanker of gas, so that you're charging enough to cover its cost plus your normal operating and profit margins.