Long story short: unauthorized sampling in hip hop has been illegal since 1991 when a district court ruled that sampling constituted copyright infringement no matter how small the sample (Grand Upright Music, Ltd. v. Warner Bros. Records Inc.). This ruling was reaffirmed in 2005 by the 6th Circuit Court of Appeals in Bridgeport Music, Inc. v. Dimension Films. These two court cases, each of which ruled against the hip hop artist defendant dramatically changed the course of hip hop. The original way hip hop music was made was deemed illegal by the judicial system.
Generally in copyright cases there is something called a De Minimis defense, which allows the defendent to argue that that piece of the original work that they ‘borrowed’ is so small and insignificant that copyright law does not apply. However the rulings in the two cases mentioned above demonstrated that in practice there is no De Minis defense for hip hop music made via sampling.