On these stated assumptions, refinancing from 7% to 5.5% comes out about $33,930 ahead over a 7-year stay after $6,000 of closing costs.
A point and a half at this level usually wins if you stay, and usually still wins after full closing costs are counted. The trap is extending the term without noticing.
The stated example
Inputs: $400,000 balance, 27 years left, new 30-year term, $6,000 of closing costs, 7-year stay.
Measure
Stay at 7%
Refinance to 5.5%
Monthly principal and interest
$2,751
$2,271
Monthly change
$480 less per month
Break-even on closing costs
Month 13
Interest over a 7-year stay
$185,970
$146,041 plus $6,000 costs
Net over the stay
$33,930 ahead by refinancing
Lifetime interest if held to term
$67,792 less with the refinance after costs
What drives this particular drop
A 1.5 point drop on $400,000 changes the payment by $480 a month before costs, against $6,000 of fees, so the fees are repaid in month 13.