The spec is probably an approximation of the optical characteristics of the lens. In particular:
- If the lens has a limited aperture (all do), diffraction will limit how many megapixels of true resolution you can get. There are computational ways to overcome the diffraction limits such as Canon's Digital Lens Optimizer (DLO), but I suspect a cheap Raspberry Pi won't be ideal for running those algorithms.
- All lenses have chromatic aberration. It can be reduced by rather simple correction algorithms, but you lose sharpness if doing so.
- The sharpness of the lens is limited, too, due to optical imperfections. The cheaper and the more complex the lens is (zooms are more complex), the worse the sharpness will be. For example, I have been considering a 150-600 zoom but so far have been using 400 prime because of limited sharpness of the 150-600 zoom. If the lens has a variable aperture, you could try to improve sharpness by increasing its f-number closer to the diffraction limited aperture. For example, the Canon EF 50mm f/1.8 STM lens has entirely different performance at f/1.8 wide open than at f/2.8.
Strictly speaking, a lens does not have a megapixel rating, but it is possible to give a very very rough approximation of the resolution you get from the lens.
DSLR/mirrorless camera owners probably do not consider a megapixel rating valuable tool because the performance of a lens can vary based on the part of the picture you're looking at (center, mid-frame, corner), the zoom setting of the lens, the focus distance of the lens, the aperture value used, etc. So instead of looking at one megapixel value, they want to know the full characteristics of the lens. Sometimes, a lens is good on one camera but soft on another. There also may be a lot of copy-to-copy variation between lenses.