Why do dealerships assume warranty risk instead of the manufacturer?

I'm pretty sure the manufacturer does pay for the warranty repair. But only at the fractional rate. The dealership effectively passes that loss onto its employees. Working for a small, independent shop can have better wage/salary, but often lacks benefits (health care in particular) and comes with all the usual downsides of a small business (one bad owner/manager can ruin the experience).

If they assess that a repair needs three hours, then only pay two hours of work if it's under warranty, I don't see how that doesn't mean that either they know that the book estimate is an overestimate and reimburse the correct amount, or the book estimate is correct and the dealership effectivley assumes 33% of the warranty risk because they only get reimbursed for 66% of the repair cost. (the third alternative is that the book estimate is underestimating, but that's basically the second case, but worse).

Neither of those cases looks like fair business dealings

It's effectively two different book rates, the warranty book assumes a new car. The non-warranty book assumes an older car. Older car = rust, rounded fasteners, and other things that add to the time.

Mechanic gets used to working at non-warranty rates, so any warranty works feels like being cheated.

Does it all balance out in the end? Maybe. But, that's not what mechanics "feel" like happens. And they're paid little enough (generally) that the two books annoys them. And the working conditions are bad enough (both physically, but also "mentally" - many shops are hostile workplaces, or close to it, with poor benefits, long-ish hours, etc). So, they have a lot to bitch about, generally.

To give them an incentive not to just rubber stamp every warranty claim.