I lately see many websites that uses Apple SF font as a system font and I very doubt that they have license for it. Is there a trick to do, so it can be used in a site legally?
In Apple's case, Myles Maxfield of WebKit explained how to use the system fonts:
Web content is sometimes designed to fit in with the overall aesthetic of the underlying platform which it is being rendered on. One of the ways to achieve this is by using the platform’s system font, which is possible on iOS and OS X by using the
-apple-systemCSS value for the “font-family” CSS property. On iOS 9 and OS X 10.11, doing this allows you to use Apple’s new system font, San Francisco. Using
-apple-systemalso correctly interacts with the font-weight CSS property to choose the correct font on Apple’s latest operating systems.
WebKit is an Apple funded and directed project.
More generally, HTML/CSS can specify either local or remote fonts be used. If a specified font is available locally, it is presumed legal, and used by the browser.
If the site is distributing a font, then the site must have a licence for the font's distribution and use.