The simple explanation is that a current 2nd lender does not have to agree to allow a new 1st to be replaced ahead of it.Subordination.
Even HELOC’s that have a zero balance are already recorded as a 2nd up the maximum amount of your line.
These normally need to be paid off and/or closed when you refi to a new 1st. You can get a HELOC again after you close on the new 1st.
If you are taking cash out from the refi to pay off the HELOC, you are subject to cash out refi pricing which is usually a higher cost/rate unless you have 40%+ equity OR the HELOC balance was used to purchase the property. (non recourse, acquisition debt)
1st Loans may also price out differently when you have a 2nd behind them.
This has nothing to do with prepay penalties or length of time that 2nd has been there.
There still are lenders for fixed 2nds. My best will only loan up to a max of 75% (in CA) including an existing 1st.
That was the simple answer. A particular situation could be more complicated… HLS
PS: You can argue with them for as long as you want.