The back of my CVS gc states it can not be used to purchase "Pre-paid cards". Whatever that means.
The back of the Walgreens card states that "Store Credit can not be used to purchase gift cards". So you'd have to be sure that it's not a store credit before buying the Walgreens card.