Is it worth taking a slightly lower rate from a lender who sells your mortgage versus a slightly higher rate from one who keeps it?

Take the better rate. Who ends up servicing the loan doesn't change a single term of your note. When a loan is sold, only the servicing rights change hands, meaning who you send the payment to. Your rate, your term, your balance, and every other term of the note stay exactly as written, and the new servicer has to honor the contract you signed. The deal you locked is the deal you keep. Some lenders offer a slightly worse rate in exchange for a promise to keep your loan for a set window, often the first 36 months. Look at the limits of that promise. Nobody guarantees they'll hold the loan for the full life of a 30-year term, and even if they did, a transfer can't change your terms anyway. You'd be paying a premium for protection against a non-problem. The market reality: a small handful of large servicers hold the majority of loans regardless of who originated them, so there's a decent chance your loan lands with one of them no matter which lender you choose. The rate is what affects your wallet every month for as long as you hold the loan. Optimize for the lower rate and the lower cost.