Gasoline prices surged over the last two days as Hurricane Harvey headed toward the U.S. Gulf Coast refining hub, but analysts warned that the price difference against crude oil could come crashing back down next week.

The weather event is pushing up gasoline prices because a number of refineries have shut down. Flooding threatens to damage the facilities on the Gulf Coast, which is home to nearly half of U.S. refining capacity. It's pushing oil prices lower because it reduces refinery demand for crude oil, the raw material used to make gasoline.

The difference in the price of crude oil for October delivery and Nymex gasoline futures for September — what the oil industry and futures traders call the "crack spread" — blew out to about $24 on Friday, almost double recent levels.

Gasoline futures rose nearly 3 percent on Thursday, while West Texas Intermediate crude, the U.S. benchmark, tumbled 2 percent.

In trading Friday afternoon, the U.S. gasoline price for deliveries in mid-September declined fractionally. West Texas Intermediate crude recovered to trade up about a half a percent at $47.63.

"It's a gasoline story more than a crude oil story at the moment," Ed Morse, Citi's global head of commodities research, told CNBC's "Squawk on the Street" on Friday.