The problems are not stored in the LMS. Instead, each embedded problem is assigned a resource link ID that is used to identify which problem from the Grader database to load.
Embedding is accomplished using LTI. You can read about the basics of this protocol here. The LMS launches the remote tool inside an iframe. The tool and its content are hosted by the tool provider. For MATLAB Grader, the tool provider is MathWorks.