The same DRM-free files will work on both. The legality of sharing the ebooks will depend on their source.
For DRMed Kindle ebooks, they can be shared between devices registered to the same Amazon account. The "sharing" actually involves downloading the ebook from Amazon's cloud to each device separately. Downloading to multiple devices (typically six at any one time) is covered by the single purchase price of the ebook.
Even without a single account, some Kindle ebooks can lent out one time for 14 days - see
Lending Kindle Books.