  We consider static spherically symmetric self-gravitating configurations of
the perfect fluid within the framework of the torsion-based extended theory of
gravity. In particular, we use the covariant formulation of $f(T)$ gravity with
$f(T) = T + \frac{\alpha}{2} T^2$, and for the fluid we assume the polytropic
equation of state with the adiabatic exponent $\Gamma = 2$. The constructed
solutions have a sharply defined radius [as in General Relativity (GR)] and can
be considered as models of nonrotating compact stars. The particle
number--to--stellar radius curves reveal that with positive (negative) values
of $\alpha$ smaller (greater) number of particles can be supported against
gravity then in GR. For the interpretation of the energy density and the
pressure within the star we adopt the GR picture where the effects due to
nonlinearity of $f(T)$ are seen as a $f(T)$ fluid, which together with the
polytropic fluid contributes to the effective energy momentum. We find that
sufficiently large positive $\alpha$ gives rise to an abrupt sign change (phase
transition) in the energy density and in the principal pressures of the $f(T)$
fluid, taking place within the interior of the star. The corresponding radial
profile of the effective energy density is approximately constant over the
central region of the star, mimicking an incompressible core. This interesting
phenomenon is not found in configurations with negative $\alpha$.
