I have mileage cards from both ANA and Lufthansa, both Star Alliance members.
If I buy an award Lufthansa flight ticket with miles from ANA card, do I earn miles on my Lufthansa card for that flight?
Points/miles are awarded based on the fare class flown. And award tickets have their own fare classes. It doesn't matter whose points/miles you used, the ticket you fly on will have an award fare class code attached. And award fare classes do not earn points/miles in any program I have ever heard of.
You know you can't, come now. An airline will grant you miles as a form of gratitude for giving money with the. All sorts of other shenanigans (non-revenue flights, industry discounts, you are the chairman of Port Authority so United runs a flight into your weekend home essentially just for you and whatever else) do not qualify. Lufthansa's policy:
In general, miles cannot be earned on flight award tickets and on travel-industry discounted tickets (e.g. ID, AD).
Also here's AA:
You may accrue mileage only for purchased, eligible, published-fare tickets