What is the role of a Network Interface Device in a ADSL connection?
The NID is owned by the phone company, and represents the point of demarcation between what they are responsible for and what you are responsible for. It contains protective devices that suppress surges caused by lightning strikes and accidental shorts to power lines, etc. It also provides the means to easily disconnect the customer equipment and test the line.

In contrast, the filter is part of the customer equipment, and is primarily intended to separate the frequencies associated with the POTS service from the ADSL frequencies, and provide a clean termination for the latter, reducing the effects of "random" POTS wiring within the customer premises (e.g., extraneous echoes and crosstalk that would reduce the ADSL signal to noise ratio).