Royal Bank of Canada (RBC) and Toronto-Dominion Bank (TD) and Canadian Imperial Bank of Commerce (CIBC) have largely avoided major increases in loan impairments and expectations for strong economic growth look likely to keep a lid on them.

But their results masked some challenges, including flat net interest margins, little to no commercial loan growth and the impact of a strong Canadian dollar.

Particularly at TD, earnings excluding the impact of provisions and taxes fell 16.8%, compared with increases of 14% and 11% at CIBC and RBC respectively.

The impact of the strong Canadian dollar and higher payments to retail partners in its U.S. credit card business weighed on earnings, TD Chief Financial Officer Riaz Ahmed said in an interview.

TD shares fell 0.7% from Wednesday's record close to C$88.19 in morning trading in Toronto. Royal Bank shares rose 1.05% to C$125.70, and CIBC gained 2.7% to C$140.83, both all-time highs. The Toronto stock benchmark added 0.3%.

"At first look we see TD's Q2 EPS beat as lower quality relative to the bank's peers," Credit Suisse analyst Mike Rizvanovic wrote in a note.

In contrast, RBC had a "solid quarter overall" and CIBC had "strength across each operating segment" although the latter's margin compression in domestic lending was a modest concern, he said.

While RBC, Canada's biggest bank, also felt some currency hit in translating earnings from its U.S. City National business, it was offset to some degree by the impact on expenses, executives said on an analyst call.

RBC released C$260 million ($216 million) from its loan-loss reserves in the second quarter, compared with provisions of C$2.1 billion a year earlier. CIBC reported an almost 98% fall in provisions, while TD recovered C$373 million of funds set aside to cover bad loans.

Analysts had expected average core earnings per share for Canada's top six lenders to more than double in the three months through April from a year earlier when they set aside nearly C$11 billion to cover potential bad loans.

CIBC and RBC also benefited from a surge in deal-making and trading activity that boosted their capital markets businesses, with the latter reporting record revenue in investment banking.

TD's wholesale banking revenue fell 8% from a year earlier on lower trading revenues, although non-interest income was boosted 6% by wealth and banking fees.

RBC posted adjusted earnings per share of C$2.79, compared with a Refinitiv IBES estimate of C$2.48 a share. CIBC's net income excluding one-off items was C$3.59, beating estimates of $3.01 a share. TD, Canada's second-largest lender, posted adjusted net earnings of C$2.04, exceeding estimates of C$1.76 per share.

($1 = 1.2094 Canadian dollars)

(Reporting by Noor Zainab Hussain and Niket Nishant in Bengaluru and Nichola Saminather in Toronto. Editing by Aditya Soni and Mark Potter)

By Nichola Saminather, Noor Zainab Hussain and Niket Nishant