  It is well-known that 3D Type-I fracton models can be obtained from the
condensations of stacked layers of 2D anyons. It is less obvious if 3D Type-II
fractons can be understood from a similar perspective. In this paper, we affirm
that this is the case: we produce the paradigm Type-II fracton model, Haah's
cubic code, from a 2D layer construction. However, this is not a condensation
of 2D anyons, but rather we start with stacks of 2D subsystem-symmetry
protected topological states (SSPT). As this parent model is not topologically
ordered in the strict sense, whereas the final state is, we refer to this
process as a distillation as we are forming a long-range entangled (LRE) state
from several copies of a short-range entangled (SRE) state. We also show that
Type-I fracton topological order can also be distilled from SSPT states in the
form of the cluster-cube model which we introduce here. We start by introducing
the Brillouin-Wigner perturbation theory of distillation. However, a more
detailed analysis from which the perturbation theory follows, is also performed
using linear gauge structures and an extension we introduce here referred to as
gauge substructures. This allows us to rigorously define distillation as well
as understand the process of obtaining LRE from SRE. We can diagnose the source
of LRE as the distillation of subsystem symmetries into robust long-range
ground state degeneracy as characterized by logical operators of the resulting
stabilizer code. Furthermore, we find which Hamiltonian terms are necessary for
selecting the ground state which results from the perturbation. This leads to a
protocol for realizing a fracton quantum error correcting code initialized in a
chosen fiducial state using only finite-depth circuits and local measurements.
