So the rules, to my knowledge, say that a melee attack can be non-lethal. Does this mean that a spell like Inflict Wounds or Primal Savagery can be non-lethal? As for ranged spells, I imagine a volatile spell like Fireball or Lightning Bolt that can hit multiple enemies couldn't be restrained to non-lethal, but what about a single target spell like Chromatic Orb or Eldritch Blast?
Only spells that include a melee attack
First, a note: there is no such thing as "non-lethal damage" in 5e. Instead there is a rule called "knocking a creature out" which is the only way to do damage without killing a creature that the rules provide.
Sometimes an attacker wants to incapacitate a foe, rather than deal a killing blow. When an attacker reduces a creature to 0 hit points with a melee attack, the attacker can knock a creature out. The attacker can make this choice the instant that damage is dealt. The creature falls unconscious and is stable.
Melee attack is a general category including melee weapon attacks as well as melee spell attacks. If a spell includes a melee spell attack, you can choose to apply this rule.
For example, the spell steel wind strike says:
Make a melee spell attack against each target.
Thus, you could apply the rule for knocking a creature out to those attacks. Also worth noting that this spell affects multiple targets. That doesn't matter; as long as it does melee attacks you can choose to knock them out.