There are various uses of "lore" and "rule". I think lore - as in element of the shared fiction - can be, or give rise to, a rule - as in a directive that governs the play of the game. But it doesn't have to. The converse is also true.
Yes, can, but doesn't have to. My contention is that one is not the other unless it is so made, either by the game's designers or its participants.
Lore equivalent to (or entailing) rules
For instance, it could easily be a rule that no dwarves may be wizards (by default, classic D&D has this rule). Is that "lore" or "rules"? Well, it's a directive with which game players are expected to comply - hence a rule. And it establishes some backstory - hence lore.
It's a rule, but it isn't lore. It doesn't establish that there are no dwarven wizards, only that a player can't play one as his/her PC. It also doesn't give any in-world reason why a dwarven PC can't be a wizard. I think this may have something to do with why racial class restrictions became unpopular. They seem to suggest that there is some in-world constraint on the races in question, but offer nothing in the way of explanatory lore. That's because they are rules for PCs that were designed for "game balance".
What about "that blue dragons come from the desert"? That seems like "lore". It can also be a rule, though - eg in some games it might govern the way the GM is allowed to frame encounters ("No blue dragon encounters in the middle of a swamp!").
It only becomes a rule if the table in question makes it one. Dragon lore, as with other monster lore, is a hook for the DM to use to fit the monster into the setting. The DM is under no obligation to use it, and once used the DM is under no obligation to maintain it consistently.
On the other hand, that the dwarven kingdom to the north is called Forgehome (a solid, Dwarf-y name) seems like "lore" - as in, a piece of backstory local to this game at this table - but not a rule. (It doesn't really tell anyone about what they can do in PC building or encounter framing or action resolution.)
Right, I mean, it doesn't establish any rules, does it? If a player decides to call the dwarf kingdom something else, that isn't a case of a rule being broken.
Rules equivalent to (or entailing) lore
Most players encounter the classic D&D restrictions on magic-user weaponry as a rule (daggers only! or daggers, staves and darts, but definitely no swords!). But clearly it produces lore, in the sense of gameworlds in which wizards are never equipped with, or fight with, swords and maces. Hence the many discussions about how one might model Gandalf's use of Glamdring within a D&D framework.
I disagree. The class restriction on weaponry doesn't establish any lore about what weapons you might expect a wizard to use in the setting because the existence of the character class doesn't establish any lore that wizards are an identifiable group of people in the setting. I'm pretty sure most editions of D&D make some allowance for characters that cast spells and wield swords, in any case.
Similarly, the fact that magic-users/wizards can't get healing magic like clerics can is normally first encountered as a rule; as part of learning the PC building rules and the spell lists associated with various classes. But it is also a major contributor to D&D lore - everyone knows that if someone is hurt you don't visit a wizard's guild, you go to a temple!
Again, I don't think the character class rules have the world building effect you attribute to them!
On the other hand, here's a rule that probably doesn't entail some lore in any straightforward way: the old success-chance-by-level table for thieves. Another one might be the healing rules in 5e (some players interpret them as showing that, in the D&D world, recovery from injury is magically fast; some interpret them as showing that hp loss doesn't typically equate to significant physical harm; others just ignore or handwave the whole thing).
I think that nicely illustrates the folly of expecting rules to contribute to lore.