Yes, you can rent an apartment on a tourist visa, but be sure to register your new address at a local police station. Some people say it’s not required, but it’s highly recommended as the police can do random inspections and visit your home. This has happened to a couple of my friends while in China.
If you’re a “friend” of the landlord and don’t “pay rent”, it’s not required to be registered as a rental apartment. When you go to a local police station to register your new address, fill in that you’re living at a friend’s place, and don’t rent a unit/room. You’ll also need to provide information about the landlord such as his or her name and the ID card number.
However, keep in mind that if your company/school will pay your rent, you need to get the invoices (fapiao, 发票) for the monthly payments. Thus, you need to have a rental unit, and “living with a friend” is generally not an option if you want to get reimbursed.