How can you get Finder to sort by name, but also sort folders before files?
There's no built in feature in the Finder to achieve that, but with the "plugin" TotalFinder you can get that. It's located under the "Tweaks" tab in the TotalFinder settings.

Edit: There was a screenshot here, but it was out of date. Look at Robsofts answer instead for an up-to-date screenshot!