In cases where lands are mortgaged, if the mortgagor fails or neglects to pay the taxes, or in case said mortgagor permits any land so mortgaged to be sold for any taxes, the mortgagee may pay said taxes or redeem any land so sold for taxes. And on the payment of any such mortgage, or in the action to foreclose the same, such mortgagee may demand the taxes so paid, with interest thereon with interest at the rate per annum prescribed by K.S.A. 79-2004, and amendments thereto, unless a different rate is provided in the mortgage contract, or include them in any judgment rendered on the mortgage; and any taxes so paid by any mortgagee shall be a lien on such lands so mortgaged until the same be paid except that where the mortgage lien covers only a part of the land upon which taxes were levied or assessed, said mortgagee shall be required to pay only the taxes upon that part covered by said mortgage, and the county clerk shall be required to apportion the taxes due upon the whole of said tract as between said mortgaged portion and that not mortgaged to said mortgagee.
K.S.A. 79-2901