By default, CDT set a buffer outside the polygons used to mask the grid about 4 times of the resolution of the grid data. You can control the width of the buffer by using the function blanking.options.

On R console you can check the blanking options with

blanking.options()
## $bufferOption
## [1] "user"
## 
## $bufferWidth
## [1] 0

The 2 arguments of this function are:

If you want to mask the grid outside of the boundaries, and exactly at the edge of the polygons, you can use the command below before starting the blanking

blanking.options(bufferOption = "user", bufferWidth = 0)