This year's Fourth of July is shaping up to be the most expensive at the pump in four years.

On Thursday, the national average for a gallon of gas stood at $3.82, according to AAA data.

That's down $0.56 from a month ago but still higher than Fourth of July prices over the past three years. It remains well below the record average of $4.80 a gallon reached in 2022.

Gas prices have fallen by nearly $0.02 per day over the past several weeks, leaving Americans spending about $300 million less on gasoline each day than they were roughly 40 days ago, according to Gasbuddy data.

"Looking at the decline, it's actually a faster decline than what we saw in 2022," Patrick De Haan, head of petroleum analysis at GasBuddy, told Yahoo Finance this week.

"To see 38 states back below the $4 gallon mark just in time for July Fourth is certainly terrific news," he added.

The cost of driving fuel has been falling as oil prices have declined, with Brent (BZ=F) futures dropping below $72 per barrel, erasing its entire war premium. The decline came after the US and Iran signed a recent agreement to suspend the conflict in the Middle East and reopen the Strait of Hormuz.

"Maybe if everything goes well, gas prices could be in the low to mid $3 range by the time that Labor Day rolls around," said De Haan.

Lower gasoline costs are expected to benefit lower-income consumers, who have been struggling with a reacceleration of inflation in the months following the outbreak of the Middle East conflict.

Bank of America noted in a recent report that around half of lower-income households describe their finances as "poor" or "terrible."

"However, in our view, lower gasoline prices, combined with higher deposits, could be a mild tailwind to narrowing the 'K' shape in spending growth," noted the researchers.

Ines Ferre is a senior business reporter for Yahoo Finance. Follow her on X at @ines_ferre.

Click here for the latest technology news that will impact the stock market

Read the latest financial and business news from Yahoo Finance