No person in doing any of the acts set forth in subdivision (d) of Section 10131, subdivision (e) of Section 10131, and Section 10131.1 shall, as agent or principal, retain funds payable according to the terms of a promissory note or real property sales contract secured directly or collaterally by a lien on real property, for a period longer than 25 days, except pursuant to a written agreement with the purchaser or lender.