Section 5A. (a) The amount of the Part A taxable income, the Part B taxable income and the Part C taxable income of any non-resident of the commonwealth derived from the Massachusetts gross income of such person shall be taxed in accordance with the provisions of section four. The Massachusetts gross income shall be determined solely with respect to items of gross income from sources within the commonwealth of such person and in determining the adjusted gross income of each Part only those deductions shall be allowed which are attributable to items included in Massachusetts gross income as so determined; provided, however, that for purposes of determining the gross income of a non-resident individual from sources within the commonwealth, the provisions of sections 1 to 2A, inclusive, of chapter 63 shall apply to a partnership subject to the definition of a financial institution in clause 9 of section 1 of chapter 63 which as of January 1, 1995, was subject to supervision and examination by the commissioner of banks and whose partners have been subject to tax with respect to income from said partnership under the provisions of chapter 62 and have been filing in the commonwealth on that basis. Items of gross income from sources within the commonwealth are items of gross income derived from or effectively connected with: (1) any trade or business, including any employment carried on by the taxpayer in the commonwealth, whether or not the nonresident is actively engaged in a trade or business or employment in the commonwealth in the year in which the income is received; (2) the participation in any lottery or wagering transaction within the commonwealth, including gaming winnings acquired at or through a gaming establishment licensed under chapter 23K; and (3) the ownership of any interest in real or tangible personal property located in the commonwealth. In computing the taxable income of each Part, the nonresident shall be allowed the deductions and exemptions provided as to each Part in section 3. For purposes of this section, gross income derived from or effectively connected with any trade or business, including any employment, carried on by the taxpayer in the commonwealth shall mean the income that results from, is earned by, is credited to, accumulated for or otherwise attributable to either the taxpayer's trade or business in the commonwealth in any year or part thereof, regardless of the year in which that income is actually received by the taxpayer and regardless of the taxpayer's residence or domicile in the year it is received. It shall include, but not be limited to, gain from the sale of a business or of an interest in a business, distributive share income, separation, sick or vacation pay, deferred compensation and nonqualified pension income not prevented from state taxation by the laws of the United States and income from a covenant not to compete. The foregoing shall not be deemed to include income from qualified tax-deferred retirement plans which are exempt from taxation under any other provision of this chapter.
(b) The commissioner shall adopt regulations providing for the method of determining the items and amounts of Massachusetts gross income derived from sources within the commonwealth by a non-resident, based upon the method set forth in section thirty-eight of chapter sixty-three or upon any other reasonable method.
(c) In applying this section, the compensation paid by the United States to its uniformed military personnel assigned to duty at military posts, bases or stations within the commonwealth for services rendered by said personnel while on active duty, shall be deemed to be from sources other than sources within the commonwealth.
(d) For purposes of this section, the ownership of an interest in real property located in the commonwealth shall include, without limitation, the ownership of an interest in a partnership, to the extent that the partnership holds an interest in real property located in the commonwealth.