In CDs should come with download codes, I argued that CDs should come with a coupon to obtain a digital copy of the album, much like a lot of modern vinyl releases do.
What didn't occur to me at the time is that there's a difference in how we think about copies of albums that we obtain that way, versus ripping a CD. When we rip a CD, we are making a personal copy of the media. We've bought a physical "token" that represents our "ownership" of the music, and we've made a copy of that — privately — for our own convenience. If we decide to get rid of the CD, then morally we really should get rid of the digital copy, too, as we've transferred our "ownership" to someone else.
Of course we don't really own the music on the CD in the first place and in the UK it's technically not legal to make a copy, even a private copy for personal use, but that's another story.
With a download code, the situation is quite different. If you buy a record with a download code, you have (at least) two copies of the album. You don't make a second copy yourself, it has already been made. And if you decide to pass on the physical album, I don't think there is any moral expectation that you should delete your digital copy.