Rules as written, you can only store prepared spells in glyph of warding
Unfortunately, this is one of those situations where what the rules likely intend, and what we all expect them to say and want them to say, differs from what they actually say.
To store a spell into the glyph, the spell must be a prepared spell, because Glyph of Warding says:
You can store a prepared spell of 3rd level or lower in the glyph by casting it as part of creating the glyph.
It does not say "You can store a spell fixed firmly in your mind", it also does not say "You can store a prepared or known spell". It says "You can store a prepared spell".
Prepared is a term that the game is very careful to use consistently and to differentiate from known, the other way you can have access to spells. For example, the multiclassing rules for spell casters say:
Spells Known and Prepared. You determine
what spells you know and can prepare for each class
individually, as if you were a single-classed member of
that class.
If there was no difference between known and prepared spells, because both are fixed firmly in your mind and thus are one and the same thing, it would not be necessary to list both of these terms.
Likewise there is this Q&A in the Sage Advice Compendium, that clearly makes a distinction between known and prepared spells:
If a druid takes the Magic Initiate feat and chooses
detect magic as their one spell, can the druid cast that
spell as a ritual? A druid’s Ritual Casting requires a ritual to be prepared. The spell from Magic Initiate is known but not prepared
The cleric class states You prepare the list of cleric spells that are available for you to cast, choosing from the cleric spell list (p. 58 PHB) , the druid class states, You prepare the list of druid spells that are available for you to cast, choosing from the druid spell list. (p. 66 PHB), and the wizard class states You prepare the list of wizard spells that are available for you to cast (p. 114 PHB) -- all of these are spellcasters with prepared spells. Even the Artificer, who is not from the core rules follows this exact pattern and states You prepare the list of artificer spells that are available for you to cast, choosing from the artificer spell list.
In contrast, the Bard, Ranger, Sorcerer and Warlock never talk about preparing spells, they only talk about the character knowing spells, and how many spells they know. Their spells are not prepared, because they know all their spells, all the time. Likewise in contrast, the cantrips known by a wizard or cleric are not prepared spells, and thus cannot be stored in the glyph.
Why then give the spell to the bard in the first place?
Glyph of Warding is on the list of the artificer, wizard, cleric and bard. Three of those are casters that prepare their spells, and so there is no problem. However the Bard does not.
This reduces to options for Glyph of Warding for the Bard. On a strict reading, a bard cannot store the spells they know into the glyph, because those are not prepared spells; they are limited to using the Explosive Runes mode.
This makes glyph of warding not entirely dysfunctional, but makes it a much less exciting choice for bards. Why even put a spell on their spell list that they cannot fully utilize, rules as written? Unfortunately, without a designer interview comment, Sage Advice ruling, or errata, we do not know if this is just an oversight in a badly worded spell, or if this is intentional. The spell was errataed in 2016, which would have been a good opportunity to fix this, but it was not changed then.
What to do with this?
I think it is quite likely that the wording is just an oversight on behalf of the designers, and it also would not be unbalancing to allow casting known spells into the glyph, just as you can cast prepared spells. I think this is one of the cases where the text as written seems to make little sense and is less fun, and the DM could ignore the rules as written and allow storing spells by bards. I would do so in my home game, and the DM is explicitly given license by the rules to fix such situations, page 4, DMG:
And as a referee, the DM interprets the rules and decides when to
abide by them and when to change them.