When the company itself changes hands
Selling a healthcare business: what happens to its data
When a whole healthcare business is sold, HIPAA treats the disclosure of its records for that sale under an exception of its own, which is not the same as licensing the data to an AI developer.
A sale of the business is not a sale of PHI
45 CFR 164.502(a)(5)(ii) bars a covered entity from selling protected health information, but its list of exceptions includes a disclosure for the sale, transfer, merger, or consolidation of all or part of the covered entity and for related due diligence. A buyer of the company receives the records as the business's new owner, which is a different thing from a third party paying for a copy.
Licensing the data before or after the deal
Licensing records to an AI developer stays a sale of protected health information unless each patient authorised it in the form 164.508(a)(4) sets out, or the data is de-identified first. Whoever holds the records after the deal is bound by the same rule if it is a covered entity or business associate. The licensing guide sets out the de-identification route.
If the business is in bankruptcy
The Bankruptcy Code gives a health care business's patients their own protections. Section 333 provides for a patient care ombudsman to monitor the quality of patient care, and section 351 sets what a trustee does with patient records when there is not enough money to keep them for the period the law requires. Section 363(b)(1) limits a trustee's sale of personally identifiable information where the debtor's own policy prohibited transferring it to unaffiliated persons.
UK health data rules on a sale
Health data is a special category under Article 9 of the UK GDPR, and processing it is prohibited unless a condition applies. Schedule 1 to the Data Protection Act 2018 lists conditions such as processing necessary for health or social care purposes; those rules bind whoever processes the data after the sale as they bound the seller.
The rules quoted here are on this site's register of healthcare data sale law, each with its own text and the day it was read.