Every device sold (iPhone, iPad, Macbook) with a battery is extensively tested in the testing process. The condition of the battery must score at least 85%.
If this is not the case, the battery is always replaced with a new one.
This applies to devices with slight traces of use as well as devices in new condition.
Furthermore, there is always a 1-year warranty on each battery. If this condition drops below 80% in the first year, it can be replaced immediately and free of charge on the spot.