(g) or (h) of this section applies, the trustee shall distribute to the debtor's spouse or the co-owners of such property, as the case may be, and to the estate, the proceeds of such sale, less the costs and expenses, not including any compensation of the trustee, of such sale, according to the interests of such spouse or co-owners, and of the estate.