Is copper piping required within a certain distance from a water heater?
Although copper may not be required, it is possible that PEX is prohibited.

One reason for this would be building codes / regulations. For instance, the UPC states:


  604.11.2 Water Heater Connections. PEX shall not be installed within the first 18 inches  (457 mm) of piping connected to a water heater.


The specifics of what your local regulations state can vary widely, so you should inquire with your local officials.



Another potential restriction could come from piping manufacturer's rules or recommendations.  For example:


  Install a minimum 18 inches of metallic or other approved material
  piping between water heater and PEX tubing.


from the TUBING INSTALLATION
PRACTICES section of  INSTALLATION HANDBOOK:
Cross-linked Polyethylene (PEX)
Hot and Cold Water-Distribution Systems of the Plastic Pipe and Fittings Association.