I learned that water enters xylem vessels in the roots after absorption by osmosis, but also that xylem cells are impregnated with lignin that doesn't allow water to pass through them to prevent water loss. Does that mean xylem cells in roots of plants aren't impregnated with it?
We have to consider the main function of lignin in xylem vessels, which is providing mechanical support for the plant. For the parts of plant above the ground, the stem where the xylem is located has to counteract the gravitational force pulling the plant down. Here's where lignin comes in to strengthen the xylem to support the plant. Remember that this is for many land plants.
Compare this to creepers, vines and aquatic plants. Lignin is absent or only present in small amounts as for creepers and vines, they have another external support, while for aquatic plants, it's weight is distributed on the surrounding water apart from the stem.
Now we can liken the case for aquatic plants to the xylem vessels in the roots of land plants. The roots of land plants are firmly anchored in the soil, and the plant's weight is distributed along the roots and soil, not just on the central root (for tapped roots). Hence there is not a need for lignin in roots of land plants.
And yes there are perforations in lignin as mentioned by @Always Confused, hence water can still enter the xylem vessel even when lignin is waterproof.