(1) No bank shall withdraw or permit to be withdrawn, either in the form of dividends or otherwise, any part of its capital or surplus without the written permission of the director. If losses have at any time been sustained equal to or exceeding the retained net income, no dividends shall be made without the written permission of the director. No dividend shall be made by any bank in an amount greater than the retained net income without the written permission of the director.
(2) As used in this section, retained net income means the sum of the bank's net income, as reported in its most recent report of condition and income, less any dividends declared during such year, for the current and two prior calendar years. Retained net income is reduced by any net losses incurred during that year not already reported in net income and by any transfers out of undivided profits to fund the retirement of preferred stock. Transfers out of undivided profits to the surplus account will not be treated as reductions to retained net income.