The only official option for players is imprisonment
There is only one method described in the rules to encase something in a gemstone and that is the Minimus Containment option of the imprisonment spell:
The target shrinks to a height of 1 inch and is imprisoned inside a gemstone or similar object.
Now imprisonment can only target a creature, but if you true polymorph an undead eyeball (preferably a particularly large one, see below) into a creature, imprison it, and then end your true polymorph, you can get an eyeball in the gem.
You can turn an object into any kind of creature, as long as the creature's size is no larger than the object's size and the creature's challenge rating is 9 or lower.
The game world is not limited in this way
All that being said, it is doubtful that the only way to acquire the components for a level 4 spell is via two level 9 spells. As such, it should be assumed that it is possible for artisans of some description to accomplish this.
The written rules for player characters don't include everything available in a game world. It is possible that the game world has other mechanisms by which such a piece could be crafted, and either your PCs, some NPCs, or the world itself can develop these reagents. You'll have to ask your GM for what other options may exist in your game.