M.2 slots can work with all kinds of modules; it just happens that SSDs are by far the most popular.
Your humble M.2 slot can do a lot more than meets the eye ...