A large part of the usefulness of mines comes from that there is no easy way to disable or detect them. An IFF transceiver which disables the mine against certain targets is therefore an inappropriate component to include on a mine for two reasons: first, a transceiver is an active component which both transmits and receives (hence transceiver rather tan receiver), which basically paints a big target marking the location of each mine in your minefield (granted, if the mine has any active components at all, like station-keeping thrusters or active sensors, this isn't a big issue, because hiding those is probably harder than hiding a weak communications signal), and jamming isn't a solution to this because your jamming would have to cover the frequency band(s) being used for the IFF queries, which disables the transceiver. And second, it's basically a minefield with an off switch that can be picked up by anyone reasonably close to ships passing through the minefield. Even worse if I'm handing it out to trading partners, because not all of my trading partners are necessarily at war with the people I'm at war with, which should make them relatively easier for my war enemies to infiltrate or obtain information or components from.
Aw. Come on. Use your imagination.
1). Mines have no need to be like they were during and prior to WWII. There is a lot of technology that allows mines to sit without emitting any except an inconsequential amount of energy (detection requires very (maybe explosively) close proximity) and still be able to recognize that some large object is approaching. They are called passive detectors.
2). Not all mines would have to check an approaching ship's IFF, in fact, such an arrangement would scramble the IFF protocol pretty badly. It would only need one, a master controller mine if you like, that would be able to turn on or off the other mines. Nor would the mine to mine communication have to be limited to a simple on/off condition, nor would the communication have to be continuous. The band width is, today, wide enough for one mine to tell the others which ships are ok and which are not.
3). You always have the risk of an enemy circumventing any of your defensive mechanisms, regardless of what it is. That is why they need to be monitored by people trained to recognize the little clues that might indicate that someone has sabotaged your defenses.
4). Any defensive measure, in order to keep it effective, has to be testable. That requires a communication component with a viable handshake protocol between the defense mechanisms and the tester. (Don't forget that even with manned mobile devices that the crew could decide to change sides. And an unmanned mobile device can be captured or circumvented just as easily as a mine.)
5). IFF doesn't have to recognize only one code, nor does it today. You can assign a different code to each of your trading partners, or each of his ships, and store those codes, with other data about his ships, into the device's IFF's data base.
6). All ships and all defensive devises would need an IFF. Otherwise how can you tell a friend from a foe? Someone could build a ship that looks like one of yours, but without IFF, how would you know if it really was one of yours. If your ship's crew or data banks don't have a valid code, you get attacked.
And there is much more.
The whole point of mines is that mines are orders of magnitude cheaper than unmanned mobile defenses, don't have to be individually manned, can be seeded into an area by a tender, are orders of magnitude smaller than an unmanned mobile device, are harder to detect than larger devices, and can be as smart as your tech base will allow.