Upon the sale, other than a tax sale under this division or a sale pursuant to Article 1 (commencing with Section 2920) of Chapter 2 of Title 14 of Part 4 of Division 3 of the Civil Code, conducted under judicial process or otherwise by any sheriff, trustee, receiver, or other ministerial officer, of any real property upon which ad valorem property taxes or assessments are due and unpaid at the time of sale, the proceeds from that sale shall, after the payment of necessary and incidental sale expenses, be first applied to the amount of those ad valorem property taxes and assessments and be transmitted by the conducting officer to the officer responsible for the collection of those taxes and assessments.