Cannot change anything inside a folder, however it's not Locked and I have all the rights I copied several folders from my TM backup (made in El Capitan) to the current system (Sierra), (I also have different username than on the system where I made the backup if that could matter) and now their contents can be changed only via sudo.

I tried running sudo chown -R &lt;my_name&gt; &lt;folder&gt; — no effect at all.
Also tried running find . -exec sudo chown &lt;my_name&gt; "{}" \; from them — again no luck.
Also tried find . -exec sudo chmod u+rwx "{}" \;, sudo chmod -R u+rwx &lt;folder&gt;. Nothing changed anything.

These folders and all their contents show up in Finder as Read&amp;Write for my user, and they also do not have Locked property set. Somehow this is not true in practice.

What can I do to fix this insanity?

I have found only one thing that actually solves it — copy the whole folder, delete old one with sudo, rename it back. But it's impractical for huge folders because it's slow and hurts SSD life.
UPDATE 2 (now I got it):
The culprit is the ACLs. Apparently Time Machine uses them, and copying via Finder preserves ACLs.
They are easy to remove recursively from folders where you know they are not needed:
sudo chmod -R -N ~/Pictures for example will drop all ACL rules in ~/Pictures and everything inside.
Source/more info: https://backdrift.org/fixing-mac-osx-file-permissions-and-acls-from-the-command-line
older unsuccessful attempts:
After some more desperate searching and brainstorming, I came up with one workaround:
1: Install coreutils from Homebrew (if not already done so)
2: gcp -dRl &lt;broken_folder&gt; &lt;temporary_folder&gt; — this will &quot;copy&quot; it with hardlinks instead of actual copying while not preserving permissions and any other &quot;invisible&quot; things which could be broken, so it's fast and almost zero damage regardless of file sizes
3: Test if permissions in temporary folder are OK &quot;in practice&quot;
4: sudo rm -rf &lt;broken_folder&gt; &amp;&amp; mv &lt;temporary_folder&gt; &lt;broken_folder&gt; — remove bad one and put fixed one in its place
based on this answer and GNU cp manual.
UPDATE:
In newer versions of macOS even this doesn't work. Looks like they are actively trying to make me switch to another OS.