Apple sends out a "service unit", which may be retail new or may be OEM refurbished and indistinguishable from new. Apple's OEM refurbishment process is described at the refurb store eFAQ (Certified Refurbished - Apple)
The summary of the process is:
"Each Apple Certified Refurbished Product:
- undergoes full functionality testing and any defective modules identified in testing are replaced.
- Apple Watch and Apple Pencil devices that require replacement parts are not included in the Apple Certified Refurbished Program.
- is put through a thorough cleaning process and inspection.
- is repackaged (including appropriate manuals, cables, new boxes).
- includes either the Operating System originally shipped with the unit or, in some cases, a more recent version.
- is placed into a Final QA inspection prior to being added to sellable refurbished stock.
Refurbishment procedures follow the same basic technical guidelines as Apple's Finished Goods testing procedures."
And, if you look specifically under iPhones at that web page, you'll see additionally:
"All refurbished iPhone models also include a brand new battery, new outer shell and a new white box."