If person A is at 4Gb of their 5Gb quota, and person B shares a folder, F, with them with 2Gb data in it, has person A just gone 1Gb over quota? Or does all of the content of F always belong to B's quota?
Person A in your scenario would have no issue, as they do not own the share. Quota for shares is counted against the share owner. However, if Person B grants read and write access to the share, Person A can alter Person B's quota usage by uploading new files to the share.
But quota is always counted against the owner, not the recipient.