This is a really interesting question. I don't have a single cohesive thought on it, but if you will bear with my rambling I've got a couple of different ones floating around.
Lore that Matters Mechanically
The Coldfire trilogy by C.S. Friedman has an interesting aspect to casting that one has to make a personal, meaningful sacrifice to do magic, and the bigger the sacrifice the greater the effect can be. It also, trying to avoid spoilers, turns out that why it requires sacrifice and the mechanism for that is important.
If lore directly affects the game, then it will matter. Back in AD&D 2nd we used to explore Myth Drannor in the Realms, an ancient overrun elven region with a powerful by unstable Mythal that affected magic cast within the boundaries. This lore became very important to us as it directly impacted how we played.
World Building and Player Sponsored Lore
My maxim when I'm creating a setting is that my prime directive is to create a place to adventure in. That prioritizes both what I put in, what I don't put in, and where I spend my time. And then I invite the players in during Session 0, building out (or letting them flesh out) what they need or don't for their characters. I like to leave lots of blank spots on the "map" (which could be history, cultures, etc, not just literal map) because the plot grows over time based on player interests and character actions (and inactions), not something I know when I start.
For instance, in my most recently completed campaign, we had the player of the druid asking if the earth was actually the body of a god, and the moon their decapitate head. So druids were pulling their magic directly from that. Huge shift, right? Well, it didn't impact anything I had already planned in ways I couldn't adjust for, so why not. Yes, a huge shift, and work for me, but exciting work, in a direction I hadn't anticipated. By the end of session zero we had that the dwarves had been genocided, and that halflings were a created servitor race. By the first session, drow also being a created race was tied in, and we ran from there. Oh, and orcs didn't exist -- not through any intentional choice, but that they (and half-orcs) never made an appearance in the campaign or lore at all and they would have if they existed in the world.
But even without things like that, players creating connections into the world that get used create instant by-in and meaningful lore. The gnoll tribes that killed off their home town. The mentor that took in the urchin. The city they survived in until they had their pinky cut off for theft. All sorts of details, large and small, that matter because a player created them and is invested in them.
If you have players of the right temperament having a player flesh out things that their the "subject matter expert" on does the same thing. Got a single player with a dwarf? When someone first takes an oath, ask them what a dwarven oath ceremony looks like -- and means to fellow dwarves. Use your players to build lore, and it will gain meaning because of that.
Character tie-in Lore
Back to world building, I love the approach 13th Age did with their default setting where it was just broad stokes at 50,000 feet full of Awesome. We had no idea about the economics or anything like that, but every entry was designed to have at least one player scream "I want to be from there" or "I want to go there". This ties in with the previous one -- they focused solely on the setting as a place to adventure, and left the details and fleshing it out to the players.
But it was more than that. First, every player has One Unique Thing. It doesn't provide any definitive recurring mechanical modifier, but it's just true. Maybe your heart has been replaced by a dwarven gear-pump. But many of them can affect the world. "I'm the only halfling to be accepted in the Emperor's Knights" or "I'm an acrobat who performed their way out of the Diabolist's Circus of Flame". Boom, organizations or other connections created. One of the samples from the book is "I'm the bastard son of the Dragon Emperor". You bet that lore about the Dragon Emperor is important, at least to that player.
Second, there are 13 huge mover-and-shaker NPCs (and their organization) in the world of various shades of gray, and the characters have positive, negative, or "it's complicated" relationships with up to three of them. The GM is explicitly urged to look for commonalities and use these player-interest-shown when creating adventures. One character's negative with the Orc Lord, a sworn enemy of the Dwarf King whom another player has an complicated relationship with, and adventure hooks write themselves.
How this ties into lore is that the players end up collectively picking a subset of these Icons that will be the focus behind things that are happening in the campaign, giving a narrow and player-directed set of lore which will be quite important.
But we're not done. Lastly, the skill system is done via named backgrounds. These function somewhat like an Aspect in Fate if you're familiar with it. And you're encouraged to be as specific as you'd like, usually because it becomes applicable in more and different places. Having a background of "Sailor +4" is nice, and you'll be good at sailor-type things. Having a background of "Quartermaster on the pirate ship Roll-Yer-Bones +4" implies a whole bunch of other times it might be applicable, while "First Mate on the Dragon Emperor's war frigate Excelsior for exploration of the Iron Sea" would have many others. And suddenly the lore that the player has either created or tied into become important to that player. What's up with the Kaiju that come from the Iron Sea and why is the Midland Sea free from their encroachment?
Summary
Okay, that got long. Basically, Lore that is player sponsored or created, and lore that has mechanical consequences, has a strong corrolation to player interest. And after that, less lore with more meaning -- sparse and full of Awesome -- makes lore that's easy for players to remember.
This isn't inclusive; not saying those are the only ways lore is good. Just some where it is.