Commentary for Bava Kamma 4:6
שׁוֹר שֶׁהָיָה מִתְחַכֵּךְ בְּכֹתֶל וְנָפַל עַל הָאָדָם, נִתְכַּוֵּן לַהֲרֹג אֶת הַבְּהֵמָה וְהָרַג אֶת הָאָדָם, לְנָכְרִי וְהָרַג אֶת יִשְׂרָאֵל, לִנְפָלִים וְהָרַג בֶּן קְיָמָא, פָּטוּר:
If an ox were rubbing itself against a wall, and it fell upon a man (and killed him), [it is not put to death. And if it were a muad, as when it were a muad to rub against walls and cause them to fall upon men, and it rubbed itself upon a wall to relieve itself and overthrew it upon a man and he died, the ox is not put to death and the owner pays kofer. The ox is not put to death, it being written (Exodus 21:29): "The ox shall be stoned and also its owner shall die" — As the death of the owner, so is the death of the ox. Just as the owner is not liable unless he killed with intent, so the ox is not liable unless it killed with intent. And the owner pays kofer, it being written (Ibid. 30): "If kofer." It could have been written: "Kofer shall be set for him." Why "if kofer"? To include non-intentional killing in kofer liability.] If it intended to kill a beast and killed a man, to kill an idolator and it killed a Jew, to kill a nefel (one of non-viable birth), and it killed a ben kayama (one with "life"), it is not put to death.
Rambam on Mishnah Bava Kamma
Bartenura on Mishnah Bava Kamma
English Explanation of Mishnah Bava Kamma
or if it intended to kill an animal and it killed a man;
or if it intended to kill a gentile and it killed an Israelite;
or if it intended to kill an untimely birth and it killed a viable infant,
it is exempt [from death by stoning].
Mishnah six deals with several instances in which an ox that kills another Jewish human being but unintentionally. In section one the ox was only scratching its back and certainly had no intention to kill. In section two the ox did have intention to kill but its intention was to kill an animal. In section three the ox did have the intention to kill a human being, but its intention was directed at killing a gentile. According to the mishnah an ox that kills a gentile will not be judged in the same way as an ox that kills a Jew. (With regards to Jewish-gentile relations see the discussion on chapter four mishnah three.) In section four the ox did have intention to kill a Jewish human being, but that Jewish human being would not have been able to live. (According to the Rabbis understanding of medicine a child born after eight months could not survive). In all of these cases since the intention was to kill something for which the ox would not be liable for the death penalty the ox is exempt from the death penalty. In other words we judge the ox by its intention and not by its actions.