When you lock a mortgage, the lender offers a menu. Pay points to push the rate down, or accept a rate above par and receive a lender credit that offsets your closing costs. The credit is real money in your pocket on closing day. The cost is a higher monthly payment that follows you for as long as you hold the loan.
Which side wins is almost entirely a question of time. Keep the loan only a short while, refinance or sell soon, and the up-front credit can easily beat the small payment difference. Hold it long enough and the higher payment quietly erases the credit, then keeps going. The month where those two forces cancel out is the break-even, and it is the single number that decides the call.
The calculator below plots the net dollars for three higher-rate-plus-credit options against a 7% par loan, across every month you might refinance. Drag the slider to your expected refinance date and read the verdict.