Why is this “desert” covered in lakes?

From PBS Terra.

Lençóis Maranhenses in Brazil looks like a desert, but it’s actually one of the most unique ecosystems on Earth. Every rainy season, thousands of lagoons appear between the dunes, creating a rare landscape. How does this ecosystem work?