Maybe.
Please describe what "legally-purchased" means.
If it came from a Kindle, the license agreement your friend agreed to as a condition of using the Kindle Store says "Unless specifically indicated otherwise, you may not sell, rent, lease, distribute, broadcast, sublicense, or otherwise assign any rights to the Kindle Content or any portion of it to any third party, and you may not remove or modify any proprietary notices or labels on the Kindle Content." https://www.amazon.com/gp/help/customer/display.html%3FnodeI...
Is the content protected by DRM? In which case you can be subject to the Digital Millennium Copyright Act, which "criminalizes the act of circumventing an access control, whether or not there is actual infringement of copyright itself." (Quoting https://en.wikipedia.org/wiki/Digital_Millennium_Copyright_A... ).
If your friend bought the epub on a USB stick from a store, and there is no DRM, and no so-called "shrink-license" which forbids transfer (see https://en.wikipedia.org/wiki/First-sale_doctrine#Ownership_... for how that plays out with software) then you are fine, in my decidedly non-lawyer opinion.
Note how that last Wikipedia link comments "if someone buys MP3 songs from Amazon.com, the MP3 files are merely licensed to them and hence they may not be able to resell those MP3 files. However, MP3 songs bought through iTunes Store may be characterized as "sales" because of Apple's language in its EULA and hence they may be resellable, if other requirements of first sale doctrine are met."
Which is why you need to know what your friend means by "legally-purchased."