By mealy bugs, I am assuming you mean those tiny bugs that you find in flour, cornmeal, rice, and dried starch products you keep in your kitchen cupboards. It seems these can be indemic in commercial grain processing and find their way into our homes. What really happens, is the microscopic eggs and pupa are present in the processed flours. Once in your home they hatch and continue their lives as the very visible clusters of bugs in our food. Once in your cupboard, they can travel by burrowing from one cardboard box to the next.
To rid yourself of these, first inspect and toss out any products with evidence of the bugs. Generally, it seems they like the bottoms of your products. Tiny pinholes in the boxes can be a sign that even an unopened product may have these bugs.
Thoroughly clean your cupboards, wiping them down with soapy water.
When shopping, any newly- purchased product should spend 48 hours in your freezer. This step kills any eggs and pupa (which are so small you can not see them). Some people further protect their food by storing in glass or metal containers.