Any such bank shall make no loan or discount on the security of its own capital stock, nor be the purchaser or holder thereof, unless necessary to prevent loss upon a debt previously contracted in good faith, and all stock so acquired shall be disposed of, at public or private sale, within six months after it is so acquired.