Tickets purchased with a voucher that is for a specific dollar amount is as good as cash and therefore earns miles.
Tickets purchased with a voucher that is for a specific type of ticket (e.g., free ticket to anywhere in the 48 continental U.S.) is treated like an award ticket and earns no miles (and is also subject to the same terms and conditions of an award ticket, specifically booking class).