Thank you for your question, this is definitely possible. I’d recommend creating a single product with different variants that represent Ebook, Physical book, and Both. You can attach digital files at the variant level using Shopify’s Digital Downloads app. You’ll also be able to adjust pricing at the variant level. Please feel free to let me know if you have any further questions!
Oliver made a great point (with the variants) and that might be viable for your situation.
However, scaling that to fulfill large volumes of digital orders - especially for selling ebooks on Shopify - is not simple and the default Shopify digital downloads app might not be good enough for you.
I’d recommend taking stock of the current digital download apps in the space to make sure you’re ready for the volume coming your way.