If you have investment income and go over the MAGI threshold, the 3.8% tax will apply to your net investment income or the portion of your MAGI that goes over the threshold—whichever is less.

This is not indicated explicitly in the Federal Tax Detail worksheet, but it will explain a difference between "net tax" and "tax" in that worksheet. 

Learn more here