Buying a home has become more affordable than leasing in Queens as prices declined and landlords raised rents, Trulia Inc. said.

Purchasing was cheaper in 98 out of the 100 largest U.S. metropolitan areas surveyed by the real estate data provider. That’s up from 97 regions last year as New York, which encompasses the suburbs as well as the city’s five boroughs, flipped positions in favor of buyers. Renting was the better deal in Honolulu and San Francisco, where a tight supply of homes pushed values higher, according to Trulia.

“Buying is cheaper than renting almost everywhere because prices have fallen so much since the housing bubble peaked,” Jed Kolko, chief economist with San Francisco-based Trulia, said. “At the same time, rents have been stable or rising in most markets.”

As home values have fallen more than 30% from their 2006 peak, the monthly cost to lease is roughly the same or more expensive than it is to buy in many U.S. markets, data compiled by Bloomberg show. Monthly apartment rents averaged $1,263 in the fourth quarter, the highest since 2008, according to brokerage CBRE Group Inc.

In New York City, purchasing became the better bargain in Queens for the first time, while the Bronx favored buyers for a second year, Mr. Kolko said. Renting remained cheaper than buying in Manhattan, Brooklyn and Staten Island.

The median sales price for a home in Queens fell 7% in the fourth quarter from a year earlier to $343,000, New York appraiser Miller Samuel Inc. and brokerage Prudential Douglas Elliman Real Estate said in January report.

With more foreclosures coming on to the market in the borough, “that’s going to keep house prices down,” said Jonathan Miller, president of Miller Samuel.

In Trulia’s survey, purchasing was cheapest in the Detroit, Oklahoma City and Dayton, Ohio, areas.

The report was based on asking prices for sale and rental homes on between Dec. 1, 2011, and Feb. 29, 2012.