SAN DIEGO — Four San Diego-area nursing homes have agreed to pay up to $6.9 million to settle allegations that they paid kickbacks and submitted phony Medicare and Medi-Cal bills.

The U.S. attorney’s office announced Thursday that the homes in San Diego and Spring Valley agreed to settle a whistleblower lawsuit and to pay the state and federal governments. The first payments were made this month.

Prosecutors say the homes acknowledged in agreements last year that nursing home employees used corporate credit cards to buy gift cards, massages, sporting event tickets and even a cruise for employees of Scripps Mercy Hospital so they would refer patients to the homes.

The homes also submitted bills for care of the illegally obtained patients, which constitutes fraud.