Retirement plan compensation has to be for personal services performed. If the S-corp's revenues are coming from the sale of assets, Mary has not provided any personal services to generate the income. Assisting with keeping clients is to protect the investment.
Another issue - in the S-Corp tax return, the sale will likely show up as a capital gain while the salary and retirement plan expense will be ordinary expenses. A large ordinary business loss every year with an equally large capital gain could raise a ref flag with the IRS, especially if the plan was audited.