Based on my past experience with AAdvantage (2016, so not so recent) and recent (late 2017) with Delta card:
When I use my credit card to book tickets for a friend, do I get the
2x miles for the price of the ticket?
Yes, the rules usually are that you're getting credit card miles for "any AA/Delta purchase" (gift cards may be excluded). In fact I've never seen in the statements the name of a passenger for AA/Delta, so I'm unsure the credit card company even knows this.
Does he get any miles for flying?
If you're asking whether he would lose miles for the sole reason you paid for his ticket, the answer is no. Your friend should get the same amount of miles for the same ticket, whether he or you paid for it.
The amount of "miles for flying" generally depend on ticket conditions (booking class, whether the flight is on a codeshare partner etc), but not the payment method. It also never mattered who paid for one's ticket - you, the flyer, were getting miles even if your company's travel department paying the tickets.
Also does he get my credit card benefits like preferred boarding or
free checked bag?
Those benefits (and priority checkin, etc) are generally only for the card holder himself/herself traveling, plus up to 8 people on the same reservation. You cannot "pass" those benefits to someone by purchasing a flight for them, unless you're on the same flight.