"Law" and "theory" are not words with rigorous scientific definitions. Do not read too much into them. They sometimes mean roughly the same thing, and sometimes they mean different things, and the connotations of each have changed over time as a matter of fashion.
For example, one might say "Newton's laws" or "Newton's theory of motion" and it would mean exactly the same thing. Or, I might say "string theory is still just a theory" and mean different things by the two different uses of "theory."
If I were to write dictionary entries for these two words it would look something like this:
Law (n)
- An axiom, fundamental idea or relation of a theory (1). E.g. "Newton's laws"
- An empirical relation between variables that may not yet have a theoretical explanation. E.g. Boyle's Law.
- A relation or principle that is a consequence of the axioms of some theory(1) that can be used to explain a large number of phenomena. E.g. "the law of conservation of momentum"
- A principle or relation that is thought to be true, regardless of its place in a theory. Often as in "conservation of energy is a law of the universe."
Theory (n)
A self-consistent, complete framework for explaining a broad class of phenomena, including axioms, definitions, and rules for predicting quantities of interest. A theory in this sense need not be experimentally confirmed or even correct, but it is expected to be able to consistently generate predictions for the results of many experiments. E.g. "Newton's theory of gravity," "string theory," "quantum field theory."
An idea or hypothesis, as in the common usage of the word. E.g. "Loop quantum gravity is an interesting theory, but they don't really know how to calculate anything yet."
In my experience, all of these usages are commonly used and understood with context distinguishing between different meanings. Do not fall into the trap of thinking that every word used by a scientist must have a special, specific meaning. Textbooks will tell you the words that do have rigorous definitions, everything else is just language as usual.