Bipartisan support helps foundations avoid tax increase in new Trump legislation