In an apartment situation you are generally renting living space from someone who owns the building and the land, although there are some places where you can own the apartment or condominium, but even then you do not own the land. Ownership rights and responsibilities would be held by the owner of the land. If the Landlord says no pets, one might gather together a group of people living in the complex and ask for that rule to be changed. Being faced with changing policy or the possibility of losing tenants, it would be the land owner's right to make that decision.
Personally, I find the idea of a cow on a balcony to be rather absurd. I can't picture there being enough room on a standard sized balcony for the healthy maintenance of a fully grown cow. (I could be wrong.) That being said, I have seen some very nice container gardens with a wide variety of fruit, veggies, and flowers on balconies and roof-tops, and I could easily picture there being enough room for a few fowl. Probably wouldn't myself, fear of heights combined with fear of the animal accidentally going over the rail and getting hurt, but that's just my opinion.
I don't know anything about HOAs. If it's a case where you own the house but not the land, I would guess it would be similar to the apartment situation. However, if you own the house and the land, and have signed over your rights to a non-governmental entity not bound by constitutional restrictions on governments... I just... I don't know. Having lived under both situations, when looking for a house back when we moved to Florida, we skipped over all apartments, condos, gated communities, and any others where we wouldn't have the rights of land-owners (or so we thought.)
Our ordinances seem a little odd to me, there is nothing that specifically prohibits livestock (horses, mules, goats, and cattle.) So we could have those, but no breeding within city limits and no allowing them to "roam at large." Two separate ordinances, enacted the same year, 1971, no hogs, and no live poultry. In another part of the ordinances, "common pets" are allowed as an accessory use of land, with the limit of no more than six animals over one year old. I don't really want to argue that we can have goats and cattle but not chickens and ducks out of suspicion they would simply create a new ordinance prohibiting all livestock within city limits.
My line is drawn at land ownership, my land, my rights, your land, your rights. It is not my right to tell my neighbors their lawn ornaments are offensive to my eyes and have to go, nor is it my right to tell my neighbors their dogs are offensive to my ears and safety and have to go, nor is it my right to tell my neighbors their plants are offensive to my nose and have to go, nor should it be, even though the lawn ornaments are ugly, the dogs (I'm surrounded!) bark at all hours of the day and night, and I am allergic to the plant species, a newer planting that wasn't there when we moved in, the scent causes a reaction when the wind blows from that direction. I could tell them I have a problem with any of these things, but it is not my right to force them to do anything.
But then again, our neighbors didn't complain about the birds either. Ours were discovered by a patrolling ordinance enforcer who happened to see a duck floating quietly in a pool of water. That caused him to drive down (end of a dead-end road) and see the others around the side of the house and the rooster on the patio. The roo allowed him to enter the patio and knock, but when I stepped out onto the patio he quickly placed himself between me and the stranger. He was my protector that day, and I betrayed him (them) by complying with the code.