Can infrastructure costs be covered by taxes on flat sales/rents? Instead of describing the general question, let me give a concrete example.
Suppose in a city they want to extend a metro line but they don't have enough budget for it. Could the city designate a locality which would mostly profit from the extension and say that in the next 10 years any flat sold or rented in the area would have an additional 10% sales tax which would go to the metro building funds? I'm thinking that this way the residents would also profit financially (even those who don't use the metro), as due to the metro extension they could sell their flats for, say, 20% more, so about half of this increase would go to the city, the rest to the residents. What would be some issues with such a tax?

Ps. Of course there are several variants, like whether the tax starts only after the extension is completed (from a bank loan), how long the tax needs to be paid (fix years or until enough money is collected), should it be also for rents or only for sales, should only the first sale of each flat be taxed or also subsequent sales, how should the boundary of the tax be determined (possibly with several zones, like some paying just half the tax), which politician should steal the money etc. I'm mainly interested in why the main idea has never been implemented, AFAIK.
Yes,

What you are describing is called value capture. There are a variety of forms of the tax, each with their own pros and cons. The general idea is that infrastructure, particularly transport infrastructure, disproportionately benefits parties closest to the line.

A good example is happening in Western Sydney in what was semi-rural land. An international airport and substantial extra development. Large land-owners found that their property is just down the road from a planned town-centre and they can build apartments on their paddocks. There was massive value uplift which was not captured by the government, but could have been.

I'm not aware of a reason why the policy shouldn't work, but it is politically tricky.