The only way chickens and other animals have B12 in their flesh, is that they eat fermented foods, in chickens' case it's soil and things in the soil.
Soil is a valuable element. SOunds gross but it has fermented rotting matter in it. Compost, rich iron, copper, fermenting micro-ogranisms and , yes, rotting matter with those elements in side it. So when an animal eats food from the ground, or food with soil in it, they eat b12. B12 is basically made when earth and vegetable matter starts to ferment.
Even if you eat a speck of soil on a carrot or spinach leaf, that's b12. Seaweeds, spinach, mushrooms, kale, leeks, onions, potatoes and the usual array of soily veg will do it.
Also fermented foods like miso paste, miso, marmite, vegemite, beer! have it. Fortified foods have b12 added.
Pick soily veg. Most veg and fruit is sanitised to an inch of its life now, so be aware that a farmers market leek has got some grit and dirt in it- that's good. But most mushrooms have it too, and always the potatoes and yams would have a grain of dirt. Eat that.
Cows make b12 because they have more than one stomach. They eat grass or hay, and the matter goes through a few digestive processes. They create the organisms somewhere around the 2nd stomach.
Humans only have one stomach, so we do not make the b12 in our bodies. Hence, the normal eating of many normal foods is a fine way to get it. Foods are made WITH the soil on them. We are not supposed to peel, strip, clean and bleach the natural foods on earth.
Also, we need the very smallest amount of b12- 2 micrograms a day. Over a year, this counts to about half a thimble full in volume. That is so tiny you can hardly see it.
We recycle b12 from our muscles too. In essence, one hardly needs to eat it at all. Just a very very small amount, which the body is designed to turn over and put back to use.