The problem is that the first and the last lines have different line spacing compared with the rest of the text. This is the code:
\documentclass[10pt]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[russian]{babel}
\usepackage[OT1]{fontenc}
\usepackage[demo]{graphicx}
\usepackage{euler,beton}
\usepackage{tikz,tkz-euclide}
\usetikzlibrary{calc}
\usetkzobj{all}
\usetikzlibrary{fpu}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{patterns}
\usepackage{cutwin}
\geometry{
paperwidth=145mm,
paperheight=215mm,
inner=16mm,
outer=10mm,
top=10mm,
bottom=40mm,
marginparsep=5mm,
marginparwidth=40mm,
includemp,
includehead
}
\usepackage[nopar]{lipsum}
\usepackage{xstring}
% https://tex.stackexchange.com/a/26808/2595
\makeatletter
\def\unpacklipsum#1#2#3{%
\count@=#1\relax
\advance\count@\m@ne
\def#3{}%
\loop\ifnum\count@<#2\relax
\advance\count@\@ne
\edef#3{#3\csname lipsum@\romannumeral\count@\endcsname}%
\repeat}
\makeatother
\def\loremnchars[#1]#2{%
\unpacklipsum{#1}{#1}{\myunpacked}%
\StrMid{\myunpacked}{1}{#2}% same as \StrLeft{\myunpacked}{#2}
}
\begin{document}
\loremnchars[1]{255}
\opencutright
\begin{shapedcutout}{2}{16}{0.90\textwidth, 0.79\textwidth,0.7\textwidth, 0.65\textwidth,0.61\textwidth, 0.6\textwidth, 0.55\textwidth, 0.58\textwidth, 0.58\textwidth, 0.58\textwidth, 0.6\textwidth,0.61\textwidth, 0.65\textwidth,0.7\textwidth, 0.79\textwidth,0.90\textwidth}
\loremnchars[1]{600}
\end{shapedcutout}
\begin{marginfigure}[-8.5cm]
{\caption{ }\label{Brahmagupta1}}
\rightline{\begin{tikzpicture}[scale=1]
%=============================
\tkzInit[xmin=-0.5, xmax=6.6, ymin=-5, ymax=2.5]
\tkzClip
%==========================================
\tkzDefPoints{0/0/A, 2.5/2/B, 6/0/C}
\tkzDefLine[orthogonal=through B](C,A) \tkzGetPoint{t}
\tkzInterLL(B,t)(C,A) \tkzGetPoint{P}
\tkzCircumCenter(A,B,C)\tkzGetPoint{O}
\tkzInterLC(t,B)(O,A) \tkzGetPoints{D}{a}
\tkzDefMidPoint(A,D) \tkzGetPoint{T}
\tkzInterLL(T,P)(C,B) \tkzGetPoint{F}
%==================================================
\tkzDrawPolygon[very thick](A,B,C,D)
\tkzDrawCircle(O,A)
\tkzDrawSegments(A,C B,D T,F)
%\tkzFillPolygon[color = gray,opacity=0.3](C,T,F)
%================================================
\tkzLabelPoint[left](A){$A$}
\tkzLabelPoint[above](B){$B$}
\tkzLabelPoint[right](C){$C$}
\tkzLabelPoint[below](D){$D$}
\tkzLabelPoint[above left](P){$P$}
\tkzLabelPoint[below left](T){$T$}
\tkzLabelPoint[above right](F){$F$}
\tkzMarkRightAngle[size=0.2](C,P,D);
\tkzMarkRightAngle[size=0.2](P,F,C);
\tkzLabelAngle[pos=0.4](T,A,P){$\alpha$}
\tkzLabelAngle[pos=-0.4](T,P,A){$\alpha$}
\tkzLabelAngle[pos=0.4](C,P,F){$\alpha$}
\tkzLabelAngle[pos=0.4](P,B,F){$\alpha$}
\tkzLabelAngle[pos=0.5](T,P,D){$\beta$}
\tkzLabelAngle[pos=0.7](P,D,T){$\beta$}
\tkzLabelAngle[pos=0.5](F,P,B){$\beta$}
\tkzLabelAngle[pos=0.8](F,C,P){$\beta$}
\tkzMarkSegment[pos=0.5, mark=|](A,T)
\tkzMarkSegment[pos=0.5, mark=|](T,D)
%============================================
\tkzDrawPoints(A,B,C,D,P,T,F)
\end{tikzpicture}}
\end{marginfigure}
\loremnchars[1]{255}
\end{document}
This is the output:
You can see a distinct overlap on the first picture. It is not that visible on the 2nd one, but it is there. The first overlap can be fixed maually by inserting something like \bigskip
in between the parafrphs, but how to tuckle the 2nd one?
\vspace{0.5\baselineskip}
inshapedcutout
environment