PS4 Game sharing, could I get banned?

No need to worry: the licence for most downloadable games on the PlayStation Store (like FantaVision, for example) allows them to be installed and used on multiple systems. When your system has the legal right to run a game, it is said to be 'activated' for that game.

One-time licence fee to download to multiple PS4 systems. Sign in to PlayStation Network is not required to use this on your primary PS4, but is required for use on other PS4 systems.

Note the use of the term primary here. When you say that you use the account as 'a primary', I assume that you mean you use it as your typical account. However, each SEN account allows one PS4 to be activated as the primary system. Although you generally need to be logged in to a system to play a game tied to your account, this isn't necessary on a system activated as the account's primary.

So in your situation, if your friend's account has his system designated as its primary, he can play his games without being logged in, while you can log in to play them (which is probably best for your friend in the long run). Or, he can make your system his account's primary, and you can play his games without logging in as him, while he can log in to play his games (probably not such a great idea).

You might think that the scenario is designed only for a single person, but Sony explicitly frames it in terms of accessing your content on a friend's PS4, so forget about being banned.

Some caveats:

  • You need to be logged in to SEN in order to play online multiplayer or to install updates.
  • You can't be logged in to both the primary and the non-primary simultaneously.
  • These two points in turn means that you can't play online multiplayer with your friend using a single account and licence, and whoever is non-primary can't play if the primary system is logged in (for example, if your friend is usually logged in to SEN even when playing single-player games).
  • There can only be one non-primary PS4 activated at a time. If your friend logs in on a third PS4, the existing non-primary will be deactivated and logged out.
  • This only works with downloaded games; disc-based games require the disc to run.

Otherwise, have fun!

EDIT: to address your first update, no—if the account holder is logged in to the primary system (for example, to play multiplayer), the non-primary system can't run the game, because it needs to be logged in to do so, and only one system can be logged in at a time. If you want to play your friend's game with him online, you'll both need a copy of the game.

If you want to play the games on his account online, and you expect him to be logged in to his account sometimes, you'll need to convince him to make your system the primary, so that his logging in and out won't affect your gameplay. That way, you can still log in to your account and play any games he's purchased and downloaded to your system.

EDIT: to address your second update, consoles and accounts can both be suspended or banned. Sony lists the reasons either may happen, and the closest reason I can find is Account or Financial Scamming/Fraud.

This is an important one, because it happens if a user is found to have someone else's login details. If it is found, both console and account are banned on the first offence.

People complaining about being banned for sharing games with their friends have most likely publicly admitted to giving their friend their login details. If you and your friend decide to do this, don't share login details. Your friend can log in on your PS4 without disclosing those details to you.