Sort of. You can earn frequent flyer miles for purchases made (such as the cost of buying your ticket or purchases made on miles-earning credit cards) for “free” since they don’t incur any additional charges besides the original purchase price.
You can also buy frequent flyer miles directly from airlines for a cash equivalent if you’re short and only need a few more.