Section 31N. In determining gross income under this chapter, if the federal gross income includes any item of gain or has been reduced by any item of loss, with respect to property, then the federal gross income shall be increased by the excess of the federal adjusted basis of the property over the Massachusetts adjusted basis of the property, and shall be decreased by the excess of the Massachusetts adjusted basis of the property over the federal adjusted basis of the property, so that the gain or loss realized for Massachusetts purposes takes into account all applicable differences in the Massachusetts and federal tax rules over the life of an asset that should, in principle, give rise to differences in basis. The Massachusetts adjusted basis of property shall be the federal adjusted basis, except that: (i) any federal adjustment resulting from provisions of the Code that were not applicable in determining Massachusetts net or gross income at the time the federal adjustments were made shall be disregarded; and (ii) adjustments shall be made for any item that was applicable in determining Massachusetts net or gross income but that was not so applicable in determining federal net or gross income and for which a federal adjustment would be allowed under the Code if the item had been applicable in determining federal net or gross income. Without limitation of the foregoing, the federal basis of shares in a business corporation that was formerly treated as a corporate trust or of shares in a successor of that entity shall be reduced in computing Massachusetts adjusted basis to take into account any tax-free earnings and profits accumulated by the former corporate trust.