It is a filter to keep high frequencies from causing interference to nearby electronic things. Since it is near the connector then I think it filters the thing that it is powering because if it filters itself then the filter would be closer to itself.

Just keep in mind that without it, your device is more susceptible to high frequency spikes and is more likely to be seriously damaged. A common source for such spikes is a power surge, especially ones caused by lightning storms.

It's there for your protection. If you care more about not having a little black bump in the cord than you do about the safety of the device, then you should be fine without it. Otherwise, they make clip-on ones that you may be able to buy for cheap.