Google will give Yahoo 2.7 million shares of stock to settle two-year-old allegations that Google infringes on keyword advertising patents owned by Overture Services, now owned by Yahoo. Google gets a perpetual license to the patents.

The payout also settles a dispute over some warrants to buy Google shares that Yahoo came by in 2000. Yahoo had argued that Google owed it more shares than the 1.2 million it handed over in June 2003.

Google, which is widely expected to execute its initial public offering in the coming weeks, expects the offer price of its shares to be between $108 and $135, meaning Yahoo’s slice could be worth up to $364m.

According to a Securities and Exchange Commission filing yesterday, Yahoo intends to sell off more than 1.6 million Google shares at the time of the IPO itself, potentially netting over $200m cash.

Following the IPO, Yahoo will be left owning over 1.6 million shares of Class A stock, 4.1% of its competitor, and another 4.9 million shares of Class B stock. Yahoo will have 2.2% of the voting power in the newly public company, according to the filing.

Because of the payoff, Google will record a loss in the quarter ending September 30, its first loss for some time, due to a non-cash charge of between $260m and $290m. It will see an income tax benefit of between $100m and $115m.

The Overture patent describes: A system and method for enabling information providers using a computer network such as the internet to influence a position for a search listing within a search result list generated by an internet search engine.

Overture had argued that Google’s AdWords, which provides the vast majority of the company’s revenue, infringed this patent. Google denied it. Settling the suit means Google can continue to offer the service without fear of more suits.