Research in mice has found that the transfer of immunity from mum to baby can be long-term, beyond the period of breastfeeding. They also found that this protection was driven by the transfer of immune cells and was completely independent of antibodies.

Source: Breastfeeding moms’ milk can transfer lifelong protection against infection to their babies