Ok, sorry, but I'm going to be the Negative Nancy here and tell you that your entire premise just doesn't work.
Note that a lot of what I write here is essentially a duplication of answers to the question you linked here. Although I didn't realize it until I'd already written most of this.
The best things you can do are 1) limit magic so not everyone can use it (to keep magic rare like you want), 2) make the magic scroll a physical device that's hard to duplicate properly so you earn money by making reliable scrolls, not designing rune programs (makes piracy worthless instead of preventing it), and 3) implement scroll physics that degrades scrolls over time and/or with use, with better-made, more expensive scrolls lasting longer (or you'll go out of business when all 10 magicians in your town have every scroll they need).
Additionally, you might make the "scroll" something small and easy to carry, with "wands" that organize and allow rapid access to the scroll you want. Better scrolls and wands are smaller, lighter, and have better algorithms for accessing the correct scroll.
Alternately, you can just handwave it all and say, "When you purchase the spell over the internet, it magically gets inscribed in your brain and nobody else can use it. Because I said so."
If magic is as easy as you say, everyone will be using it.
If I can just print out several copies of a spell using some special ink, then touch the paper and Boom! fireball happens, people aren't going to randomly stop believing it works. Instead, they're going to go through enormous efforts to figure out how it works until either everyone has access to magic, or the world is destroyed in World War 3.
The only way people stop believing in something is if it stops happening. We didn't stop believing in vampires and werewolves and Bigfoot and Nessie because "like, reasons, bro". We stopped believing in them because there's literally zero evidence any of these things exist, and a great deal of evidence that they're all folk tales that have been modified and added to over centuries.
If you have a very small number of magicians who very carefully protect knowledge of magic from the rest of the world, you can potentially keep it a secret. If the secret is maintained long enough, people will stop believing in magic. If a spell or two gets cast in front of the muggles here and there, people at large won't think too much of it. But the instant one magician shows the world at large that magic is real, your entire Masquerade just shattered.
This is made enormously worse by having readily-copied magic spells. If a vampire is discovered in L.A., the vampire community can sneak in, kill him, and destroy the body. Then, even if there's a good amount of evidence a vampire existed, it's possible the whole thing will eventually be forgotten. But if the vampire turns a hundred people into vampires first, the vampire community will have a very hard time hunting them all down before every other think-tank in the world has a vampire test subject. Likewise, if the ability to cast magic can easily be transferred (without even having to drink blood or burn up in the sun!), the magical community is going to be very hard pressed to keep it a secret.
In order to prevent this, you need to create some kind of hard, physical device that mostly or totally prevents muggles from using magic at all:
- Magic can only be cast using one of the 1591 wands left by an alien race, and nobody knows how to create new ones. The magical community will keep very close track of where each of the wands is, and only transfer wands under certain circumstances. Further, only the most "eligible" magicians will ever get a wand.
- Magic spells use a very rare ingredient that only a few people have access to and is extremely difficult to produce. Occasionally, a muggle will acquire a bit and cast a spell or two, but magic will be almost exclusively limited to the rich and powerful magicians. This can be subverted if the amount or type of ingredient depends on the spell type or strength. Then, muggles would commonly have access to common spells, but only the rich and powerful would have access to rare spells.
- Magic requires an enormous amount of practice to get right, and you pretty much have to be taught by someone else who learned it from the aliens who built the wands, the gods who put magic in the world, etc. So even if a muggle gets their hands on a spell scroll, magic wand, etc., nothing will happen.
- Magic can only be cast by people with the "magic gene". However, you can't just say it's normal DNA. If it's normal DNA, then you just breed a bunch of magicians together, and you will statistically get more and more magical offspring until you have an entire community of pure-blood magicians. Who will then take over the entire world until the only survivors are magicians. Instead, the magic gene needs to be random in some way. Like, there are only 1591 magic genes on the planet, and when someone dies, the gene floats away into an embryo somewhere on the planet. Maybe it tends to float into embryos near the dead guy, so the magicians are likely to figure out who the new magicians is and bring them into the fold. Or maybe there's a spell to track them. Alternately, maybe the gods randomly give the magic gene to every four hundredth child born during a full moon, so the proportion of people with the gene is constant.
In any case where muggles can use magic, but don't have immediate access to it, the magical community would have to be very strict with magicians who show or teach magic to others. Otherwise, you'd get
Julius magicians who just want to make some friends, and pass magic out to the muggles regardless of the rules.
In any case where muggles are physically incapable of using magic, you're going to run into one of a couple scenarios:
- Magic is so powerful the magicians enslave and/or destroy all the muggles.
- Muggles vastly outnumber magicians and burn all the magicians at the stake because they float1. A few magicians survive, use their magic to build enormous power bases, remember Salem, and enslave or destroy all the muggles.
- The magicians stay hidden in Hogwarts with various spells that prevent muggles from finding them. Then some Voldemort types use their magic to build enormous power bases, destroy the other magicians, then enslave or destroy all the muggles.
- Magic is powerful, but a decent group of citizens armed with pitchforks can take on a single magician. Because there aren't very many magicians in the world, your average citizen isn't too worried about them, and magicians are mostly left alone.
The last scenario is the one you want. You still have to deal with the fact that magicians will tend to rise to positions of prominence and power, and that muggles will tend to know about magic. But at least you have a fairly stable ecosystem with both muggles and magicians. With sufficient policing, a Masquerade can exist for a time, but will ultimately fail.
As pointed out ad nauseum, you can't copy-proof anything sent via email.
This is compounded by the fact that you've explicitly decided that the "source code" is readily visible for all to see, and there's no way to "compile" or obfuscate the code.
To be fair, I'm not really sure you know what you're talking about here. Compiled code is still just code, which can always be reverse-engineered into "source code". The difference is that source code is typically full of helpful comments to explain the code and meaningful object and method names to self-document the code, so it's easy to understand, while compiled code lacks these features and is therefore harder to understand. But we can always deliberately obfuscate source code that compiles just fine while being very hard to understand.
Likewise, unless your runecode is very simple, it would be pretty trivial to deliberately obfuscate the "source code" so it's difficult to understand what's going on (meaning it's irrelevant that it isn't "compiled" code). This is reinforced by your statement that only an expert runeologist can decipher the code.
This means runecode would be easy to copy, but only a good runeprogrammer can edit the code to do new things without exploding the end user every third attempt. So your breadmaker would be programming custom spells for people, not the generic Scrubbing Bubbles2 stuff.
Still, you'll be a victim of piracy as soon as you program anything more than one person would want. Like a really robust spell that handles a variety of situations well. So the only way to stay in business is if your spells are only usable for a short timeframe in a specific location, meaning pirated spells stop working and the customer comes back to you for more. But what will really happen is that some semi-expert pirate will figure out what part of the runecode checks the timestamp and bypass it, then your customers will be annoyed at needing to rebuy their spells every three weeks and just buy the pirated versions.
If you really want copy-resistant spells, the act of reading and/or printing the source needs to be difficult or expensive.
This means you can't send the stuff via email. Sorry, it just doesn't work. The simple fact that the intended end user can easily print their copy means they can print dozens of other copies.
There are numerous ways you can do things from here. You can make reading the runecode difficult by printing the runecode at microscopic scales using a combination of magic and non-magic ink to obfuscate which runes are part of the source and which aren't. You can further complicate it by printing enormous amounts of non-magic text to hide the locations of the magical runes. And you can use layers to print one "page" of code on top of the previous page, so the pirate not only needs to read and analyze microscopic code, but do so in 3D.
Alternately, just make it so printing a working spell requires a great deal of time and/or skill. Maybe the ink has to be mixed flawlessly. So buying a pirated spell will probably turn you into a newt instead of teleporting you to the moon wearing a spacesuit. And might teleport you to the moon as a newt without a spacesuit. Maybe the runework has to be drawn a certain way, with certain rituals. So the pirated spell will result in a segfault just as that ogre is smacking you with a club, instead of projecting a nice shield like the real spell would.
You can combine the two, Dungeons and Dragons-style. Only an expert magician can read a complex spell scroll, and only an expert magician can transcribed a learned spell to a scroll. The possibilities are endless.
Notice, however, that we've shifted the purchased good from the runeprogramming to the scroll-making. If actually programming the spell is the really hard, expensive part, pirates will always be an issue. Because no matter how hard or expensive it might be to read and reprint a spell, it's still cheaper than designing our own program. Only if the physical duplication is the hard part will piracy stop being a problem.
You can still buy over the internet, or have instant-access scrolls.
There's no reason you can't still purchase things via a website. They just need to arrive through some physical method. Like carrier owls. You can make this method as fast as plot requires, so it's still "click the PayPal button, get a spell within 60 seconds".
You can even teleport the scrolls to the end user, but teleportation opens up enormous issues with over-powered magicians taking over the world. Perhaps the "scrolls" are actually teeny-tiny things the size of a BB, so it's easier to teleport them than something like a bomb or human. Plus, that makes it easier for the end user to store them. Then you have a "wand" that holds the pellet scrolls, and you just have to select the the right scroll, touch the pellet through the aperture, and the spell fires off. And you can make extra money selling wands that allow faster, more consistent access to the spell you want.
Alternately, you can have scrolls available via non-internet methods such as vending machines. Non-magicians won't waste their money if they can't use them. Or, the machines are hidden and only people who have the right codes can get to the machines in the magically-hidden alcove.
Ultimately, you need spell scrolls to last a limited time or nobody will need new spells.
Sure, your spellmakers will invent new spells from time to time, but most people will buy all the spells they really need then almost never buy anything again. Then pass the spells on to their kids. Etc.
Instead, you need the spell scrolls to degrade somehow. They could degrade over time, so they start failing more and more after a certain amount of time. Perhaps the most complex (and likely most highly prized) spells fail the quickest. Alternately or simultaneously, they could degrade with each use in the same way. Better, more expensive, spell-printing methods could last longer. So a \$2 cleaning spell works once and fizzles out, while a \$200 printing of the same spell lasts 5 to 10 years reliably.
This degradation has to be a physical constraint in your universe. Otherwise, one spell printer who deliberately creates degrading scrolls will go out of business as soon as another printer creates permanent scrolls for the same price.
1Yes, I'm aware this is in reference to the historical practice, but that's less humorous.
2I know I read this in an official D&D resource at some point, but for the life of me can't find any other references to it.