Can I download and play games from a friend's PSN account on a PS4?

Sharing your digital games, apps, and other downloads with your family and friends is possible with the Primary and Non-Primary Account [...]

In this example we are using Ethan and Katie who both have their own PSN account IDs. Ethan also has a bunch of digital games which he bought on the PSN Store using his PSN account. Objective: He wants to share these digital games with Katie, so this is what he does:

Explanation on how to share psn games

Both Ethan and Katie can now play the same game at the same time on PS4 (A) and PS4 (B) with no restrictions.

Benefits of activating a PS4 as Primary:

  • Anyone who uses your Primary PS4™ system can enjoy applications you purchase from the PlayStation®Store. Other users on the system can also enjoy some PlayStation Plus benefits from that account, even if that user is not logged in.

Limitations:

  • This method of sharing only applies to digital games and apps. The sharing of disc games will still require you to physically lend your discs to others.
  • When you log into a non-primary PS4 with your PSN ID, you will need an active Internet connection so that games and apps from your PSN account can be authenticated by PSN.
  • You can activate only one PS4 system as primary per PSN account.
  • You can deactivate a PS4 system only from that system.

The whole explanation and the picture belongs to gripitaustralia.

There is an official article about activating and deactivating you Primary PS4 on playstation.com.