Social Security updates the death master file on a weekly basis. Credit bureaus subscribe to this data and likely flag accounts of the deceased in case someone tries to use the cards or establish new accounts post mortem.
I wonder if there is an arranged and ongoing exchange of information, ie., “You tell me if one of your cardholders dies and we’ll tell you if we get a death notice.”