Would it be adventageous for a mammal to be poisonous?
It can be advantageous, but producing it is also biologically costly, so it’s a tossup. Male Platypuses have venomous (NOT poisonous) spurs, which are used for defense against other males, as well as predators. Some shrews have a neurotoxic venom, and can bite insects and paralyze them, so they have a little cache of fresh insects for when food is scarce (they have incredibly fast metabolisms, so not finding food for a few hours could prove fatal). It’s also recently been discovered that the slow loris (primate) may have a venom gland under their arm, and they take up the venom into their mouth if threatened. Mothers will also comb it into a baby’s fur if leaving it unattended… Point being, yes, it can be beneficial, for all the reasons you mentioned, but they need to strike a balance in how energy is utilized. If it does not provide the organism with enough of an advantage, it’s not worth the trouble/resources it takes to produce.