Why would the city buy it with the original stipulation attached if that were the case? Seems dishonest (which isn't illegal), but yeah...
That isn't generally how legal restrictions on the use of real estate work. They're just part of the property.
Compare https://www.law.cornell.edu/wex/real_covenant :
> Real covenants affect the landowner’s property rights and “run with the land,” meaning that future owners of the property are bound by the covenant.
Since there's a covenant on this land, the current owners are bound by it, regardless of the terms of sale they thought they were getting.
The reason that restrictions on real estate work this way is pretty simple: ownership of real estate is tracked in a giant centralized registry, so arbitrary restrictions can be recorded there.
Is this a good idea as a policy matter? Absolutely not. But we have the law we have.
Quoting from that page:
“The party capable of enforcing the covenant depends on whether the burden or the benefit runs with the land. In other words, only the party who the covenant is designed to help can enforce it.”
Your page spells out the other relevant bits. Real covenants must benefit one party at the expense of another (horizontal privity), so the heirs of the man who donated the land are the benefactors. That it helps (or at least doesn’t harm) the neighbor does not make them the benefactor here because their benefit was incidental (ie they aren’t legally “the benefactor”).
Covenants being centrally registered is a matter of convenience when house shopping, not a declaration that the state will enforce them.
I’d actually bet there are a lot of houses that have racial segregation covenants on them still because the benefactors quit trying to enforce them. I know my city has a bunch of racist laws on the books still because the city quit enforcing them ages ago, city council doesn’t want to spend time revoking laws that haven’t been used in 50 years, and no one has standing to sue to revoke them unless they get arrested for them.