Is it just members of the same department who do that?
No. Two San Francisco PD cops I shoot with were wearing mourning bands this morning, as was my partner, a retired SFPD inspector.
The general guidelines for mourning bands- which can vary by agency, different uniform regulations, and different states- are as follows:
General orders for proper protocol of wearing mourning bands:
For an Officer or retired Officer of this department: From the time of death until midnight on the 14th day after the death
For an officer from this state/region: From the time of death until midnight on the day of the funeral, except for-
Funeral attendees and out-of-region officers: While attending funeralNational Peace Officers Memorial Day, 15 May annually: from 0001 hours until 2359 hours.