FRANKFURT (Reuters) - Blackstone <BX.N> is to buy OfficeFirst Immobilien from IVG Immobilien AG, ending months of talks over a potential sale or stock market listing of the German property company.

Both sides did not comment on the price, but three people familiar with the process said Blackstone was paying around 22 euros per share, which, including debt, gives the deal an enterprise value of 3.3 billion euros ($3.65 billion).

In September, Reuters reported that talks between buyout group Blackstone and IVG over a potential 3.3 billion euro deal for OfficeFirst had broken down and that IVG was looking at a stock market flotation.

But a first attempt last month to list OfficeFirst failed as not enough buyers were willing to pay the 21 to 23 euros per share bankers were seeking in what would have been the second-biggest market listing in Germany this year.

It is rare for multi-billion euro property portfolios to come on to the market in Germany, which offers comparatively high yields in the current low interest rate environment. The deal allows IVG and its hedge fund owners to lock in high prices.

OfficeFirst has a portfolio of about 100 German office buildings, including the landmark Squaire at Frankfurt airport.

The acquisition is through one of Blackstone's regional real estate funds, Blackstone Real Estate Partners Europe IV, and is expected to close in the first three months of 2017.

IVG went through insolvency proceedings in 2013 after cost overruns at its Squaire development made debt levels unsustainable. Funds such as York Capital, Anchorage and Davidson Kempner had first invested in IVG's debt and later became shareholders of the company.

($1 = 0.9042 euros)

(Reporting by Joshua Franklin, Alexander Huebner and Arno Schuetze; Editing by Maria Sheahan and Jane Merriman)