In a past life I worked as a Realtor. This was back in the 90s when 'Buyer's Agent' first went into affect in the State I worked in and where I focused my dealings. I loved working with buyer's on their behalf as they got my representation being their Buyer's Agent. I didn't sell them anything (in the sense of a salesman), but rather helped people buy the home that
they wanted and at a fair price. I mostly helped first time buyers and helped families purchase HUD homes, I didn't make a lot of money, just enjoyed helping others.
IMHO, there could be a possible conflict of interest if your listing agent wishes to purchase your house. Your agent knows all the reason why you want to sell and knows your lowest price, all the details they would never share with a buyer or Buyer's agent. All agents have a Broker, the head boss of the office, and is the one responsible for the actions of their agents. I would speak to your agents Broker to get their opinion about the matter.
IMHO, this is like your defense attorney, whom you told all your secrets and details, now switching to the prosecutors side at your trial.
We need more info though:
What type of listing do you have?
Example:
Exclusive right to sell, Exclusive agency listing,
Open listing, Net listing.
Which state is this in? (Net Listing not allowed in some states, there may be other rules regarding conflict of interest as well).
How much is the listing commission rate? (to see if it is enough that will attract a Buyer's agent. Perhaps a reason your property is not attracting buyers).
What is the name or franchise of the company/brokerage firm that your property is listed with?
Have you seen the MLS listing of your property? (the one where agents list properties so other agents can see them, and only agents have access to all the details of a listing. This will show the coop fee, as a %, offered).
If have seen it, what is the co-op commission rate? (the amount the listing agent is sharing with buyer's agents).
These are important bits of information to determine how your agent is representing you and presenting, and advertising, your property to other agents and the public.
Even if your agent buys it, a commission will still need to be paid (depends on the listing type) to the Broker of the company your listing is with (unless your agent is the Broker and owns the firm, may be other rules involved there too). Typically, after closing the Broker splits the commission with the listing agent along with the Broker of the Buyer's agents (if there is one). The ratio depends on the arrangement the agent and broker have and may differ if the agent is a party to the transaction (actual buyer or seller).
If you do sell to your agent, the Broker may insist that another agent in the office represent you as your Seller's agent. It may even be possible that your agent's Broker insist that your listing be removed from their office and your property listed with a competing office to ensure there is no conflict of interest, or you being represented by a real estate attorney. Even the appearance of a conflict of interest is something to be avoided by Brokers.
Another issue is to ensure a fair value, the appraisal:
Typically, the Buyer pays for the appraisal, required by the lender (pending on the amount put down etc.). But since your listing agent wishes to buy your house, you may well want to have your own appraisal done. If I was the Broker of your agent/buyer, I'd want you to have one done by an appraiser which you choose to protect me from even the appearance of a conflict of interest. With an appraisal bought by you from an appraiser who have chosen, reduces the appearance of a conflict of interest as a third neutral party has shwon that the selling price was fair.
In the past (way before the 2008 financial crisis), listing agents would provide the appraiser with the sales contract to
help them to appraise the property very near to the agreed selling price ( the lender not
minding, depending on the lender and loan type). I believe that today, the appraiser would be more conservative in their evaluations and tread very carefully, but this also depends on the lender and loan type (FHA/VA, Conv etc.), the down payment, etc. I am mentioning this because if your agent knows the appraiser, or even worked with him/her in the past, this could
appear to create a possible conflict of interest. Let me add that appraisers are very professional and use a lot of factors and variables to reach a property value for the benefit of the lender. I would not expect any foul play from an appraiser, same for Real Estate Brokers (your agent's boss). Perhaps today the listing or selling agent no longer have knowledge of who the appraiser will be. Now, if your agent is also the broker and sole agent in their firm and their spouse or business partner is the appraiser, then watch out.
In the end though, the goal is for all parties to be satisfied with the price and feel that they were treated fair.
With all of the the above, let me add that I am no longer a licensed agent, and only was one back in the 90s for a few years. I forgot a lot more than I knew back then and I was merely an agent and not a Broker. So the above is just my [now] laymen's opinion.