Hair masks are deep, intense conditioners with a variety of roles. It's expected to moisturize our hair, give it shine, provide nourishment and strengthen the hair from the inside. Even though we wash off hair masks, it leaves behind some great effects.
Hair masks are designed to deeply penetrate the hair's cortex. To what end? According to Vaibhav Kaushik's study in June 2022, coconut-based oils penetrated three layers of hair.
This barrier prevents the diffusion or otherwise the movement of molecules between the layers. Therefore, this very barrier explains some of the other benefits of hair masks which includes hair colour protection and moisturisation. For example, the molecules that colour the hair wouldn't be able to escape and be washed out as quickly as when there isn't a barrier.
Not only does tangling require a lot of work to fix, but trying to detangle hair can break and damage the hair which requires even more time and treatment to resolve.
As nicely explained in Bharat Bhushan's book, the Biophysics of Human Hair, hair masks which are just deep conditioners, flatten the cuticle on the hair's surface and the hair feels smoother, allowing strands to glide over each other without getting locked together. If you wondered why detangling is easier during or after conditioner application, the cuticle flattening is why it works.
Once detangled, another property of hair masks prevent detangling. Hair is usually negatively charged, and damaged hair even more so. Conditioners are made of positively charged molecules which are attracted to the hair. So once the hair is dry, the effects of the conditioner remains for a time, keeping the hair free from tangles until the next wash.