Suppose an adventurer retires and wants to buy a tavern.
Is there an official gold piece figure in D&D 5e for how much it would cost to buy a tavern or similar property in a town or city? If not, are there any guidelines?
Warning: possible spoilers of the adventure ahead.
In the Chapter 2 of Waterdeep: Dragon Heist, the "Open for Business?" section (page 41) explains how the characters can reopen a closed tavern located in Trollskull Alley. Since the building is already there, the cost for maintenance is 1000 gp, plus 250 gp paid upfront for the guild licenses and contracts. There's additional details involved, like the guilds you have to talk to (Brewer's Guild, Fellowship of Innkeepers, etc), but the cost to open is 1250 gp.
After opening, you have to pay an additional 60 gp every tenday for maintenance costs and guild expenses, and you have to roll a d100 + 10 and consult the Running a Business table in chapter 6 of the Dungeon Master's Guide to determine whether the tavern lost money or earned profit.
Besides the option above, if you wanna build one from the ground up, your best guideline is to use the building cost of a Guildhall or Trading Post, presented in the page 128 of the Dungeon's Master Guide. Pages 126-127 of the DMG also provide guidelines for recurring expenses of an Inn (be it on rural roadside or within a town/city).
Maintenance costs of a tavern are described in detail (DMG 127). The purchase of a tavern is not described in detail, but there are a few things that provide guidance.
Building A Stronghold (DMG 128) offers pricing for land and estate deeds which are the listed first step to building a stronghold, this would be the land on which your tavern is build or resides. Then you can compare the kind of tavern that you want to build with the listed strongholds, of which a tavern notably is none. A DM may choose the price at their discretion and could be advised by comparing your desired tavern to the most similar building on the Building a Stronghold-table (DMG 128).
The rules offer no further guidance on buying taverns. They do mention that retired adventures commonly own taverns (DMG 127, 129) and receive them as rewards (DMG 129).