Free to you, but HP is likely paying Ubuntu. They wouldn't be paying much, but they're probably paying something.
The Ubuntu license says that if they make any modification whatsoever, no matter how trivial, they can no longer call it Ubuntu. Just adding a driver is enough to trigger the clause, AFAICT.
Most likely it is an agreement that is seen as a win on both party. HP has no incentive to pay ubuntu for anything, and ubuntu can't get any new market if it starts asking companies to pay for it.
And they could use whatever distro they want that do not have those clauses instead of ubuntu.
The agreements would have been signed when Ubuntu had >50% Linux market share. Increasing share is not particularly helpful in that scenario compared to increasing revenue per seat.
Also, these agreements are Ubuntu's primary revenue source, AFAICT. And they have hundreds of millions in revenue per annum. Primarily from the cloud vendors.
All distros have these clauses. The software is free, but the name is a protected registered trade mark. Not all distros enforce it, but the HP lawyers will ensure HP is covered.
Finally corporate buyers will want a trusted distribution, not the flavor du jour.
As far as I heard from Canonical employees, Canonical was getting more per sold XPS13 (original Developer Edition) with Ubuntu than Microsoft did for every Windows being sold on the same laptop: when it was introduced, at the very least.
The Ubuntu license says that if they make any modification whatsoever, no matter how trivial, they can no longer call it Ubuntu. Just adding a driver is enough to trigger the clause, AFAICT.