I might be missing some technical details as this is all based on observations.
To say "treated identically by the system", we must first identify a "system", which isn't easy as there are relationships between more or less separate things...
The media type must be changed to make a physical game run from SD (as opposed to internal storage), this obviously changes some handling but I don't think the exact differences are documented
Content files downloaded from Nintendo have "1st layer" encryption, based mainly on titlekeys (and some other factors only linked to the individual title), that's what the "shallow" option of D9 is for; physical games have hardware encrypted data flowing out of the rom, but by the time you can see the card in GM9 or as a .3ds file, this has already been stripped
Each content/partition/ncch has encryption based mainly on one (selected by the title's header) of some keys preprogrammed in the console, plus seed if enabled; in theory this could be absolutely equal between physical and digital, however physical games always have the seed disabled (although it could technically work, it would add a stupid online requirement for the first launch), all titles converted between formats are usually fully decrypted due to the above edit requirement and then left that way
The titleid doesn't need to change in the conversion process (and it would be foolish to do so, given that then it wouldn't match update titles, miiverse groups, friends list data... plus some games outright break)
The version number in the cia header isn't processed correctly by every tool, but again a cia is unplayable as-is, and once installed all that remains are version numbers inside, not like it matters when most online games have update titles to install anyway
I don't know whether the console or the servers choose which type of header should be sent, or on which point this decision is based
Oh, and physical games are launched with an all-zero titleid, though they end up running as the correct one